Created attachment 382 [details] Fix the problem (dmd 2.030) DMD dies without any error message compiling this valid code: -------------------- immutable int[2] array = [ 42 ]; enum e = array[1]; -------------------- The array initializer in this code contains one element. In this case ArrayInitializer::toExpression() wrongly generates an ArrayLiteralExp of one element, not two elements (notice the int[2]). Then DMD references missing second element, and dies. The patch fixes this problem. And DMD rejects this valid code: -------------------- immutable int[1] array = [ 0: 42 ]; enum e = array[0]; -------------------- test.d(1): Error: array initializers as expressions are not allowed test.d(1): Error: array initializers as expressions are not allowed test.d(1): Error: array initializers as expressions are not allowed test.d(1): Error: array initializers as expressions are not allowed -------------------- ArrayInitializer::toExpression() does not implement support for array index in static array initializers. The patch also implements it.
Created attachment 390 [details] Additional patch: fix segfault on fwdref ArrayInitializer will cause a segfault when it's forward referenced. Please apply this patch in addition to the first patch.
Fixed dmd 1.046 and 2.031
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル