www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 11126] New: Link failure when using instancing anonymous classes to a static variable

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

           Summary: Link failure when using instancing anonymous classes
                    to a static variable
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: link-failure
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: andrej.mitrovich gmail.com


--- Comment #0 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2013-09-26
06:07:16 PDT ---
-----
class C {}

void main()
{
    static C c = new class C {};
}
-----

$ dmd test.d
Error 42: Symbol Undefined _Dmain12__anonclass16__vtblZ

However I'm not sure I understand why the above is allowed to compile
(nevermind the link failure), since the following fails to compile:

-----
class C {}

void main()
{
    static /*C*/ c = new class C {};
}
-----

test.d(5): Error: variable test.main.c is mutable. Only const or immutable
class thread local variable are allowed, not test.main.__anonclass1

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