www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 8072] New: Methods defined in external object files when template alias parameter is involved

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: leandro.lucarella sociomantic.com
                CC: bugzilla digitalmars.com, clugdbug yahoo.com.au
        Depends on: 8016


--- Comment #0 from Leandro Lucarella <leandro.lucarella 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: -------
May 09 2012
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8072



--- Comment #1 from Leandro Lucarella <leandro.lucarella sociomantic.com>
2012-05-17 09:33:52 PDT ---
Commit with the testcase integrated in the test suite.
https://github.com/llucax/dmd/commit/63d8046d296720a4c85608454795bad60ab5ad86

(remove the disable option when fixed!)

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