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)
{