[Issue 3730] New: Struct's explicit constructor can't initialize global variables

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jan 20 12:20:10 PST 2010


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

           Summary: Struct's explicit constructor can't initialize global
                    variables
           Product: D
           Version: 2.039
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: tomeksowi at gmail.com


--- Comment #0 from Tomasz Sowiński <tomeksowi at gmail.com> 2010-01-20 12:20:09 PST ---
Test case:

struct S {
    int a;
    this(int a) {
        this.a = a;
    }
    static immutable S es = S(3);
}

Compiler output (message printed twice in original):
test.d|9|Error: cannot evaluate ((S __ctmp516;
test.d|9|Error: cannot evaluate ((S __ctmp516;

Don't know if that should compile but surely the message could be more
appealing.

static this() may be used as a workaround for this bug.

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