[Issue 6039] New: C-style initialization of structs doesn't take field initializers into account
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu May 19 21:47:25 PDT 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6039
Summary: C-style initialization of structs doesn't take field
initializers into account
Product: D
Version: D2
Platform: Other
OS/Version: Windows
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: andrej.mitrovich at gmail.com
--- Comment #0 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2011-05-19 21:43:15 PDT ---
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?
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list