This is the D1 version of bug 4516. Rejected as 'forward reference error' up to D1.053. Worked correctly in 1.054 and 1.055. Wrong code in 1.056 and later. Works if the definition of B is moved above A. struct A { B b; } enum B { Z = 2 } void main() { A x; assert(x.b == 2); }
mtype.c, line 4110. Basically the same patch as bug 4516. int TypeEnum::isZeroInit(Loc loc) { + if (!sym->isdone && sym->scope) + { // Enum is forward referenced. We need to resolve the whole thing. + sym->semantic(NULL); + } + if (!sym->isdone) + { + error(loc, "enum %s is forward referenced", sym->toChars()); + return 0; + } return (sym->defaultval == 0); }
http://www.dsource.org/projects/dmd/changeset/682
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル