This is not valid D code, but obviously DMD should not segfault on this: interface I { } interface K { void func(); } class C{ this(){ I i = new class() I { K k = new class() K { void func(){ this.outer.outer; } }; }; } int i; } void main(){ }
Don't know what the error message should be, but this patch at least fixes the segfault for DMD2.028. Note that in this bug, there are also error messages with no line number. Error: variable this forward referenced Error: variable this forward referenced fog.d(12): Error: No parent ----- The line number is known in mtype.c line 6070, but isn't known in the variable declaration itself. --- v = s->isVarDeclaration(); if (v && !v->isDataseg()) { Expression *ei = v->getConstInitializer(); --- Index: expression.c =================================================================== --- expression.c (revision 23) +++ expression.c (working copy) @@ -5673,12 +5674,15 @@ t1 = t1->nextOf(); type = type->addMod(t1->mod); - + + if (!var->toParent()) { + error("No parent"); + return this; + } AggregateDeclaration *ad = var->toParent()->isAggregateDeclaration(); e1 = getRightThis(loc, sc, ad, e1, var); if (!sc->noaccesscheck) accessCheck(loc, sc, e1, var); - VarDeclaration *v = var->isVarDeclaration(); Expression *e = expandVar(WANTvalue, v); if (e)
Fixed DMD2.030 and 1.045
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル