template forward reference (important)

C. Dunn cdunn2001 at gmail.com
Tue Jul 31 12:02:08 PDT 2007


I was really hoping to see a response to this.  It's going to prevent me from using "D" at all.  Because of forward declarations, templates are more flexible in C++.  This problem really needs to be addressed.  I'm willing to provide as much info as necessary.

I kept the OP short, but I've actually tried a variety of ways to get this to work, including deriving the template from a non-template class in another module.  I also tried "extern class A", which compiles but leads to a link error: 
  "fooFoo.o(.data+0x30): undefined reference to `_D6fooFoo1A7__ClassZ'"
And "extern .fooA.A" does not compile.  (My modules are called fooA and fooFoo.)  Nothing I've tried works -- except putting everything into the same module.

In my example, the template calls a static method in A, but even just returning a reference to A leads to the same compilation error.  In fact, the real cause seems to be the "import fooA" at the top of 'fooFoo.d'.



More information about the Digitalmars-d mailing list