The following (incorrect) code segfaults the compiler I suppose that it is connected with something segfault on correct code of xf.omg.core.CoordSys and that it is connected with #3792 {{{ struct S { int x; template T(int val) { const P T = { val }; // the P here is an error it should be S } } template V(R,int val){ const R V=R.T!(val); } const S x = V!(S,0); }}}
This was a regression since 1.053. Suprisingly, it is fixed by bug 3767, in svn 367.
I have tried to find the problem using ldc (that shares the problem), also using the larger correct code that shows the problem (stacktraces are similar). The problem seems to be located in expression.c:5048 Dsymbol *s = ti->inst->toAlias(); ti->inst == NULL, so that the compiler segfaults. In the correct code I am not sure if inst is NULL because a single pass cannot instantiate the template, or because it is in an is expression. In any case simply catching this case and return new ErrorExp(); doesn't seem to be enough (then I have other problems).
a clean compile, and my fix doesn't look to bad. klickverbot even tested dstess, and it did not make anything worse. It might not be the correct fix, but still improves things. {{{ diff -r 9cc791423e20 dmd/expression.c --- a/dmd/expression.c Thu Feb 25 17:12:54 2010 -0700 +++ b/dmd/expression.c Sun Feb 28 23:59:36 2010 +0100 -5946,6 +5946,7 @@ eleft = dte->e1; ti->tempdecl = td; ti->semantic(sc); + if (ti->inst == NULL) return new ErrorExp(); Dsymbol *s = ti->inst->toAlias(); Declaration *v = s->isDeclaration(); if (v) }}}
SVN commit: http://www.dsource.org/projects/dmd/changeset/404
Fixed dmd 1.057 and 2.041
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル