February 27, 2004 Previous Definition Different - workaround? | ||||
---|---|---|---|---|
| ||||
I have the following code: [test.d] import testmod; void main() { printf("%d ", bar()); printf("%d ", Tfoo!(int).foo()); // {1} } [testmod.d] module testmod; template Tfoo(T) { T foo() { return 1; } } // C!(int) c_int; // {2} // alias Tfoo!(int) foo_int; // {3} int bar() { return Tfoo!(int).foo(); } When I try to compile this via explicit .obj linking, ie: dmd -c test.d dmd -c testmod.d dmd test.obj testmod.obj I got error: testmod.obj(testmod) Offset 00139H Record Type 00C3 Error 1: Previous Definition Different : _D7testmod06Tfoo_i3fooFZi If I comment {1} - no error, compiling is ok. If I uncomment {2} or {3} - no error, compiling is ok. DMD needs template instantiation in module with template declaration? P.S. When I just execute "dmd test.d testmod.d", I got no errors and all is fine. -- Sark7 |
Copyright © 1999-2021 by the D Language Foundation