[Issue 10786] New: non-trivial RTInfo generation causes link error

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Aug 9 01:19:57 PDT 2013


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

           Summary: non-trivial RTInfo generation causes link error
           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: r.sagitario at gmx.de


--- Comment #0 from Rainer Schuetze <r.sagitario at gmx.de> 2013-08-09 01:19:55 PDT ---
Change the RTInfo declaration in object.di and object_.d to

////////////////////////////////////////////////////////
template RTInfo(T)
{
    enum RTInfo = cast(void*)RTInfoImpl!T;
}
template RTInfoImpl(T)
{
    enum RTInfoImpl = &RTInfoImpl2!T;
}

template RTInfoImpl2(T)
{
    immutable RTInfoImpl2 = 1234;
}
////////////////////////////////////////////////////////

and then compile these 2 files:

/////////////////////////////////////
module ut;

void main() {}
/////////////////////////////////////
module ut2;

unittest
{
    // Original test case (revised, original assert was wrong)
    int[string] a;
    a["foo"] = 0;
    a.remove("foo");
    assert(a == null);  // should not crash
}
/////////////////////////////////////

with

dmd -unittest ut.d ut2.d

results in:

OPTLINK (R) for Win32  Release 8.00.12
Copyright (C) Digital Mars 1989-2010  All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
ut.obj(ut)
 Error 42: Symbol Undefined
_D6object74__T11RTInfoImpl2TS6object28__T16Associati
veArrayTAyaTiZ16AssociativeArrayZ11RTInfoImpl2yi
--- errorlevel 1

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