Bug 5025 – ICE(cast.c) shared struct literal

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
All
Creation time
2010-10-09T10:18:00Z
Last change time
2010-12-27T14:22:15Z
Keywords
ice-on-valid-code, patch
Assigned to
nobody
Creator
i.kasiuk

Comments

Comment #0 by i.kasiuk — 2010-10-09T10:18:10Z
Assertion failure during compilation with DMD v2.049: $ cat test.d struct S { void delegate() d; } void main() { shared S[] s; s[0] = S(); } $ dmd test dmd: cast.c:432: virtual MATCH StructLiteralExp::implicitConvTo(Type*): Assertion `t->mod == 4' failed. Aborted
Comment #1 by clugdbug — 2010-11-29T07:20:25Z
Applies to any struct which contains a non-trivial type: delegate, pointer, class, or dynamic array. There are a few other cases where it applies, not just shared. --- struct Bug5025 { int[] d; } shared Bug5025 b5025 = Bug5025(); const shared Bug5025 b5025a = Bug5025(); inout(Bug5025) bug5025c(inout Bug5025 xxx) { return Bug5025(); } ----------- PATCH cast.c line 429. ----------- m = MATCHconst; for (int i = 0; i < elements->dim; i++) { Expression *e = (Expression *)elements->data[i]; Type *te = e->type; - if (t->mod == 0) - te = te->mutableOf(); - else - { assert(t->mod == MODimmutable); - te = te->invariantOf(); - } + te = te->castMod(t->mod); MATCH m2 = e->implicitConvTo(te); //printf("\t%s => %s, match = %d\n", e->toChars(), te->toChars(), m2); if (m2 < m)
Comment #2 by bugzilla — 2010-12-27T14:22:15Z