Bug 4781 – Segfault(mtype.c) with forward referenced typeof and .init

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
Windows
Creation time
2010-09-01T02:20:00Z
Last change time
2015-06-09T05:11:58Z
Keywords
ice-on-valid-code, patch
Assigned to
nobody
Creator
clugdbug
Blocks
340

Comments

Comment #0 by clugdbug — 2010-09-01T02:20:22Z
typeof(a4781.init) b4781; typeof(7) a4781; --> Segfault on D1 & D2. By contrast, this related case gives a forward reference error followed by a useless "voids have no value" message. typeof(d4781) c4781; typeof(7) d4781; And, this third case also segfaults, but here we have a genuine circular reference which should not compile. auto e4781 = f4781.init; typeof(e4781) f4781; and another circular reference which currently gives a forward reference error. typeof(g4781) h4781; typeof(h4781) g4781;
Comment #1 by clugdbug — 2010-09-01T02:29:51Z
A quick patch to turn it into a rejects-valid: mtype.c, Type::dotExp, line 1795 + Expression *eold = e; e = defaultInitLiteral(e->loc); + if (!e) + { + eold->error("forward referenced .init (Bugzilla 4781)"); + return new ErrorExp(); + } goto Lreturn; } } if (ident == Id::typeinfo) {
Comment #2 by clugdbug — 2010-11-15T00:03:25Z
Fixed svn 755.