template forward reference
C. Dunn
cdunn2001 at gmail.com
Tue Jul 31 13:35:48 PDT 2007
Witold Baryluk Wrote:
> Famous Bug #340 and especially #102.
I do appreciate the response, but no, this is not the same bug. In my case, if Foo is not a template, everything compiles and links. It is somewhat related to #805 and #877, but I have submitted it as #1392. (I read all 21 bugs related to #340.)
So it may be a related problem, but it is far more severe than just a restriction against "nested functions within a function and autotype declarations". I'm doing something very simple -- simple enough that it compiles for non-templates. It's really a problem with templates themselves. And it works fine if it's all in the same file. So it's a combination of 'import' and 'template'.
...
I have found a work-around: If I compile the separate modules simultaneously, it works fine, even though it still produces separate .o files. Curious.
dmd -c fooA.d fooFoo.d
produces
fooA.o and fooFoo.o
but
dmd -c fooFoo.d
produces
fooA.d(9): template instance forward reference to template declaration Foo(T)
fooA.d(9): Error: Foo!(char) is used as a type
It seems like an awkward solution, but at least it works.
More information about the Digitalmars-d
mailing list