Bug 9843 – DMD segfaults on code involving struct and union with initialization

Status
RESOLVED
Resolution
WORKSFORME
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
All
Creation time
2013-03-30T19:20:00Z
Last change time
2013-06-01T04:15:42Z
Keywords
ice
Assigned to
nobody
Creator
mk

Comments

Comment #0 by mk — 2013-03-30T19:20:57Z
module something; import std.stdio; struct ArgTest1 { int itemid; int number; } struct ArgTest2 { string userid; int[] items; } union Argument { int nul; ArgTest1 test1; ArgTest2 test2; } struct TestSt { Argument _arg = { nul : 0 }; this(ArgTest1 a) { } } class Something { immutable TestSt foo; this() { foo = TestSt(ArgTest1(1,2)); } void dowork() { writeln( foo ); } } dmd -c something.d something.d(40): Error: cannot implicitly convert expression ((TestSt __ctmp1218 = _D9something6TestSt6__initZ; , __ctmp1218).this(ArgTest1(1, 2))) of type TestSt to immutable(TestSt) Segmentation fault dmd 2.062 32bit Linux/Windows
Comment #1 by bearophile_hugs — 2013-03-30T20:05:38Z
A little reduced, but I don't know if the bug is the same: import std.stdio: writeln; struct Foo { int[] items; } union Bar { int nul; Foo test; } struct Spam { Bar b = {nul : 0}; } void main() { immutable Spam s; writeln(s); }
Comment #2 by mk — 2013-03-31T05:15:36Z
Seems same to me, changing description.
Comment #3 by mk — 2013-06-01T04:15:42Z
This bug disappeared in dmd 2.063.