Bug 4950 – Compiler fails an assert and crash when declaring a inmutable array of structs with a Variant[string] member

Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2010-09-27T12:40:00Z
Last change time
2010-09-27T13:25:54Z
Keywords
ice-on-valid-code
Assigned to
nobody
Creator
juanjux

Comments

Comment #0 by juanjux — 2010-09-27T12:40:23Z
This crash the compiler: import std.variant; alias string function() TestFunc; struct Crashy { Variant[string] variantmember; this(Variant[string] m) { variantmember = m; } } void get_something() { immutable Crashy[] blah = [ Crashy(["one": Variant(1)]) ]; } I don't know if it is correct D2, but the compiler bails out with: dmd: expression.c:816: void expToCBuffer(OutBuffer*, HdrGenState*, Expression*, PREC): Assertion `precedence[e->op] != PREC_zero' failed. Removing the immutable works. Using DMD 2.049
Comment #1 by clugdbug — 2010-09-27T13:20:11Z
A duplicate of bug 4926, I think.
Comment #2 by juanjux — 2010-09-27T13:25:54Z
(In reply to comment #1) > A duplicate of bug 4926, I think. Looks like it is, indeed, I'll resubmit once 4926 is fixed if this still happens. *** This issue has been marked as a duplicate of issue 4926 ***