Bug 8072 – Methods defined in external object files when template alias parameter is involved

Status
RESOLVED
Resolution
WORKSFORME
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-05-09T08:06:00Z
Last change time
2015-03-03T13:38:48Z
Keywords
link-failure
Assigned to
nobody
Creator
leandro.lucarella

Comments

Comment #0 by leandro.lucarella — 2012-05-09T08:06:08Z
+++ This issue was initially created as a clone of Issue #8016 +++ Testcase: m1.d --- module m1; import m2; private void t(alias Code)() { return Code(); } void f() { t!( () { } )(); } // The forceSemanti() and static assert is only needed to reproduce it in D2 bool forceSemantic() { f(); return true; } static assert(forceSemantic()); void main() { } --- m2.d --- module m2; import m1; --- dmd -c m1.d dmd -c m2.d dmd -ofm m1.o m2.o m2.o: In function `_D2m11fFZv': m2.d:(.text._D2m11fFZv+0x0): multiple definition of `_D2m11fFZv' m1.o:m1.d:(.text._D2m11fFZv+0x0): first defined here collect2: ld returned 1 exit status --- errorlevel 1 nm m1.o | grep ' T' 0000000000000000 T _D2m113forceSemanticFZb 0000000000000000 T _D2m115__unittest_failFiZv 0000000000000000 T _D2m11fFZv 0000000000000000 T _D2m11fFZv9__lambda1FNaNbNfZv 0000000000000000 T _D2m17__arrayZ 0000000000000000 T _D2m18__assertFiZv 0000000000000000 T _Dmain nm m2.o | grep ' T' 0000000000000000 T _D2m11fFZv 0000000000000000 T _D2m11fFZv9__lambda3FNaNbNfZv I think neither D2m11fFZv or _D2m11fFZv9__lambda3FNaNbNfZv should be defined in m2. Confirmed to be D2-only.
Comment #1 by leandro.lucarella — 2012-05-17T09:33:52Z
Commit with the testcase integrated in the test suite. https://github.com/llucax/dmd/commit/63d8046d296720a4c85608454795bad60ab5ad86 (remove the disable option when fixed!)
Comment #2 by k.hara.pg — 2015-03-03T13:38:48Z
Seems fixed from 2.052.