Thread overview
[Issue 3476] New: C-style initializer for structs must be disallowed for structs with a constructor
Dec 12, 2009
Kosmonaut
Dec 31, 2009
Walter Bright
November 05, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3476

           Summary: C-style initializer for structs must be disallowed for
                    structs with a constructor
           Product: D
           Version: unspecified
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Keywords: accepts-invalid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: andrei@metalanguage.com


--- Comment #0 from Andrei Alexandrescu <andrei@metalanguage.com> 2009-11-05 13:55:02 PST ---
struct S {
    int a;
    this(int) {}
}

S s = { 1 };

This code should not compile. The presence of the constructor means S's author wants to guard some invariant. The C-style constructor may initialize the object to an arbitrary value.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
December 12, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3476


Kosmonaut <Kosmonaut@tempinbox.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |Kosmonaut@tempinbox.com


--- Comment #1 from Kosmonaut <Kosmonaut@tempinbox.com> 2009-12-12 14:06:50 PST ---
Relevant SVN changeset: http://www.dsource.org/projects/dmd/changeset/291

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
December 31, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3476


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla@digitalmars.com
         Resolution|                            |FIXED


--- Comment #2 from Walter Bright <bugzilla@digitalmars.com> 2009-12-31 11:20:02 PST ---
Fixed dmd 2.038

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