// credit goes to http://f17.aaa.livedoor.jp/~labamba/?BugTrack%2F27 template Foo() { static this(){} } void main() { mixin Foo; } ---------------- Assertion failure: 'ad' on line 877 in file 'func.c' abnormal program termination
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 d-bugmail@puremagic.com schrieb am 2006年12月04日: > http://d.puremagic.com/issues/show_bug.cgi?id=642 > // credit goes to http://f17.aaa.livedoor.jp/~labamba/?BugTrack%2F27 > template Foo() > { > static this(){} > } > > void main() > { > mixin Foo; > } > ---------------- > Assertion failure: 'ad' on line 877 in file 'func.c' > > abnormal program termination Added to DStress as http://dstress.kuehne.cn/nocompile/t/this_14_A.d http://dstress.kuehne.cn/nocompile/t/this_14_B.d http://dstress.kuehne.cn/nocompile/t/this_14_C.d http://dstress.kuehne.cn/nocompile/t/this_14_D.d http://dstress.kuehne.cn/nocompile/t/this_14_E.d http://dstress.kuehne.cn/nocompile/t/this_14_F.d http://dstress.kuehne.cn/nocompile/t/this_14_G.d http://dstress.kuehne.cn/nocompile/t/this_14_H.d http://dstress.kuehne.cn/nocompile/t/this_14_I.d http://dstress.kuehne.cn/nocompile/t/this_14_J.d Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFFd//uLK5blCcjpWoRAvZCAKCTGJoNDgTVbtzDoOqWe2tGCkOpwACeJ8X9 AlznwJrxg03qHRyLa7S6foc= =kFUs -----END PGP SIGNATURE-----
In LLVMDC we fixed this_14_G/H by making the "constructors/destructors are only for class definitions" error fatal. Otherwise you get a segfault around func.c line 908 trying to access the InvariantDeclaration of the AggregateDeclatation* ad that is zero.
Created attachment 305 [details] Verify isThis() in addPostInvariant() and addPreInvariant(). This patch fixes G/H while handling errors normally. All of the other is*Invariant() methods check for ad, but static contructors and desctrutors assume it's there, seemingly. -[Unknown]
Created attachment 306 [details] Validate that a static destructor has a parent. This fixes this_14_I. It just adds a clause, similar to the one for static constructors, for static destructors. This throws a very similar error and doesn't crash. -[Unknown]
*** Bug 1533 has been marked as a duplicate of this bug. ***
Another example of 14G/14H, from bug 1533. [Unknown]'s patch fixes this, but does result in one of the error messages having no line number. --- template T(){ this(int i){} // causes 14G segfault ~this() {} // causes 14H segfault } struct C{ void foo(){ bar(); this.t(7); } mixin T!() t; }
Fixed DMD2.030 and 1.045. The segfault bug in 14G and 14H is fixed, as are all of the ICE bugs. 14G has one error without line number ("Error: 'this' is only defined in non-static member functions, not this") but since it comes after errors with line numbers, it's trivial.
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル