[Issue 10425] New: Link error with templates

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jun 20 09:05:04 PDT 2013


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

           Summary: Link error with templates
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: link-failure
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: siegelords_abode at yahoo.com


--- Comment #0 from siegelords_abode at yahoo.com 2013-06-20 09:05:03 PDT ---
DMD version 2.063.0 through .2. Worked ok in 2.062. 32/64 bit Linux.

This needs two files, test.d and bug.d
///////////
module test;

import bug;

void main()
{

}

///////////
module bug;

struct A()
{
    int opCmp(const ref A p) const
    {
        return 0;
    }

    string toString()
    {
        return "";
    }
}

struct B()
{
    void foo()
    {
        auto a = new A!();
    }
}

struct C
{
    alias A!() a_t;

    this(B!() b)
    {

    }
}

When compiled this way there are no errors:

dmd test.d bug.d

However, when compiled this way I get link errors:

dmd -c bug.d && dmd test.d bug.o

test2.o:(.data._D23TypeInfo_S3bug6__T1AZ1A6__initZ+0x40): undefined reference
to `_D3bug6__T1AZ1A5opCmpMxFKxS3bug6__T1AZ1AZi'
test2.o:(.data._D23TypeInfo_S3bug6__T1AZ1A6__initZ+0x48): undefined reference
to `_D3bug6__T1AZ1A8toStringMFZAya'

-- 
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