[Issue 6691] New: static constructor inside template cannot initialize immutable template members

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Sep 18 18:44:16 PDT 2011


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

           Summary: static constructor inside template cannot initialize
                    immutable template members
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: k.hara.pg at gmail.com


--- Comment #0 from Kenji Hara <k.hara.pg at gmail.com> 2011-09-18 18:43:52 PDT ---
Follwing should compile, but can't.

template Hoge()
{
    immutable static int[int] dict;
    immutable static int value;

    static this()
    {
        dict = [1:1, 2:2];
        value = 10;
    }
}
alias Hoge!() H;

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