www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3730] New: Struct's explicit constructor can't initialize global variables

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: tomeksowi gmail.com



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: -------
Jan 20 2010
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3730


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |clugdbug yahoo.com.au



This works for me in DMD2.039 Windows svn 342. (Are you sure you're not using
2.038?)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 20 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3730




PST ---

 This works for me in DMD2.039 Windows svn 342. (Are you sure you're not using
 2.038?)
Yes, I even compiled from command line to make sure. C:\Projekty\Witajki\Witaj Phobosie>dmd Digital Mars D Compiler v2.039 Copyright (c) 1999-2009 by Digital Mars written by Walter Bright Documentation: http://www.digitalmars.com/d/2.0/index.html [snip] C:\Projekty\Witajki\Witaj Phobosie>dmd test.d test.d(8): Error: cannot evaluate ((S __ctmp1; ) , __ctmp1).this(3) at compile time test.d(8): Error: cannot evaluate ((S __ctmp1; ) , __ctmp1).this(3) at compile time There's more output after newline which CodeBlocks didn't pick up. I don't know the SVN rev. of my DMD, though. Maybe sb fixed that after the release? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 21 2010
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3730


yebblies <yebblies gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |yebblies gmail.com
         Resolution|                            |FIXED



This compiles without error in dmd2.053

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 12 2011