this invalid piece of code crashes the dmd compiler. [CODE] void main() { string crash = 01 ~ " foo?"; } [/CODE]
This looks similar to a BUG 1702 which did get fixed, a later release appears to have re-introduced it.
Only segfaults on D2. fog.d(2): Error: incompatible types for ((1) ~ (" foo?")): 'int' and 'immutable( char)[]' fog.d(2): Error: Can only concatenate arrays, not (int ~ immutable(char)[]) fog.d(2): Error: cannot implicitly convert expression ("\x01 foo?") of type int to immutable(char)[] [SEGFAULT]
This is indeed the same as bug 1702. A patch to fix this one also fixed 1702. *** This bug has been marked as a duplicate of 1702 ***
Oops, 1702 seems to be already fixed. This isn't the same. Here's a simple patch which prevents the segfault. Index: optimize.c =================================================================== --- optimize.c (revision 23) +++ optimize.c (working copy) @@ -456,6 +457,8 @@ Expression *e1old = e1; e1 = e1->optimize(result); e1 = fromConstInitializer(result, e1); + + if (!type->toBasetype()->ty) return this; // Bugzilla 1916 if (e1 == e1old && e1->op == TOKarrayliteral &&
Fixed DMD2.030 and 1.045.
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル