Bug 3476 – C-style initializer for structs must be disallowed for structs with a constructor

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
Linux
Creation time
2009-11-05T13:55:00Z
Last change time
2015-06-09T05:14:57Z
Keywords
accepts-invalid
Assigned to
nobody
Creator
andrei

Comments

Comment #0 by andrei — 2009-11-05T13:55:02Z
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.
Comment #1 by Kosmonaut — 2009-12-12T14:06:50Z
Comment #2 by bugzilla — 2009-12-31T11:20:02Z
Fixed dmd 2.038