[Issue 4328] New: templated unittests fail to link when instantiated from other file if compiler order isn't correct

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jun 16 06:46:45 PDT 2010


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

           Summary: templated unittests fail to link when instantiated
                    from other file if compiler order isn't correct
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: schveiguy at yahoo.com


--- Comment #0 from Steven Schveighoffer <schveiguy at yahoo.com> 2010-06-16 06:46:44 PDT ---
testunittest.d:

struct S(T)
{
  unittest
  {
    assert(0);
  }
}

testunittestmain.d:

import testunittest;
void main()
{
    S!int s;
}

When compiled this way:

dmd -unittest testunittest.d testunittestmain.d

The following error occurs:
testunittest.o: In function `_D12testunittest8__T1STiZ1S11__unittest3FZv':
testunittestmain.d:(.text._D12testunittest8__T1STiZ1S11__unittest3FZv+0x9):
undefined reference to `_D12testunittest15__unittest_failFiZv'
collect2: ld returned 1 exit status

If I compile this way:

dmd -unittest testunittestmain.d testunittest.d


The compiler generally has no problem with order of files for linking, I would
expect the same here.

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