www.digitalmars.com         C & C++   DMDScript  
Archives

D Programming
digitalmars.D
digitalmars.D.bugs
digitalmars.D.dtl
digitalmars.D.ide
digitalmars.D.dwt
digitalmars.D.announce
digitalmars.D.learn
digitalmars.D.debugger
D.gnu
D

C/C++ Programming
c++
c++.announce
c++.atl
c++.beta
c++.chat
c++.command-line
c++.dos
c++.dos.16-bits
c++.dos.32-bits
c++.idde
c++.mfc
c++.rtl
c++.stl
c++.stl.hp
c++.stl.port
c++.stl.sgi
c++.stlsoft
c++.windows
c++.windows.16-bits
c++.windows.32-bits
c++.wxwindows

digitalmars.empire
digitalmars.DMDScript
electronics


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


--- Comment #0 from Tomasz Sowiński <tomeksowi 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: -------
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


--- Comment #1 from Don <clugdbug yahoo.com.au> 2010-01-20 12:55:03 PST ---
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 parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3730



--- Comment #2 from Tomasz Sowiński <tomeksowi gmail.com> 2010-01-21 10:56:04
PST ---
(In reply to comment #1)
 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