[Issue 8072] New: Methods defined in external object files when template alias parameter is involved

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed May 9 08:04:47 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=8072

           Summary: Methods defined in external object files when template
                    alias parameter is involved
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: wrong-code
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: leandro.lucarella at sociomantic.com
                CC: bugzilla at digitalmars.com, clugdbug at yahoo.com.au
        Depends on: 8016


--- Comment #0 from Leandro Lucarella <leandro.lucarella at sociomantic.com> 2012-05-09 08:06:08 PDT ---
+++ 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.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list