Summary: Regression (1.x git-415e48a) Methods defined in
                    external object files when a pointer to it is taken
           Product: D
           Version: D1
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: regression
          Priority: P2
         Component: DMD

--- Comment #0 from Leandro Lucarella <> 
2012-03-21 05:25:44 PDT ---
How to reproduce:

echo 'class C { void asdfg() {} }' > inc.d
echo 'import inc; void f(C c) { auto x = &c.asdfg; }' > m.d
dmd -c -release -inline m.d ; nm m.o

This prints:
00000000 t 
         U _D10ModuleInfo6__vtblZ
00000000 D _D1m12__ModuleInfoZ
00000000 T _D1m1fFC3inc1CZv
00000000 T _D3inc1C5asdfgMFZv
         U _Dmodule_ref

Which means that _D3inc1C5asdfgMFZv (AKA inc.asdfg()) is included in the text
(code) section of m.o, but it shouldn't, it should only be in inc.d (which I
didn't even compile), otherwise when linking both inc.o and m.o you'll get a
"multiple definition" error. Symbol D3inc1C5asdfgMFZv should have U (undefined)
or maybe at most v/W (weak linkage).

Please note that the compiler flags -inline -release has to be used to
reproduce the bug, removing either makes it go away. -O is irrelevant.

This regression was introduced by commit
415e48ac4703ffab94cd6ce5a3211625099c637a in D1, which is the fix for bug 4820.

This bug prevents using Tango, so I guess it should be high priority among
regressions (reverting the fix for bug 4820 in the latest dmd-1.x branch fixes
the problem, and I think is even better to leave that bug unfixed instead of
introducing this new regression).

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to