Bug 6039 – C-style initialization of structs doesn't take field initializers into account

Status
RESOLVED
Resolution
WORKSFORME
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2011-05-19T21:43:00Z
Last change time
2013-09-17T13:10:06Z
Assigned to
nobody
Creator
andrej.mitrovich

Comments

Comment #0 by andrej.mitrovich — 2011-05-19T21:43:15Z
import std.stdio; struct S { int a; int b = 2;} void main() { S a = S(1); S b = {1}; writeln([a.tupleof]); // [1, 2] writeln([b.tupleof]); // [1, 0] assert(a == b); // fails } AFAIK there was some talk about deprecating C-style struct initialization, or am I wrong about that?
Comment #1 by andrej.mitrovich — 2013-09-17T13:10:00Z
Fixed in a version earlier than 2.062, don't know exactly which one.