dmd tmp2.d tmp2b.d tmp2b.d(6): Integer constant expression expected instead of SIZE tmp2b.d(6): Integer constant expression expected instead of SIZE ----- tmp2.d ----- private import tmp2b; const int SIZE = 7; ----- tmp2b.d ----- private import tmp2; struct s { char a[ SIZE ]; } Workaround: Move constant above import of other module. ----- tmp2.d ----- const int SIZE = 7; private import tmp2b;
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 d-bugmail@puremagic.com schrieb am 2006年10月26日: > http://d.puremagic.com/issues/show_bug.cgi?id=461 > dmd tmp2.d tmp2b.d > tmp2b.d(6): Integer constant expression expected instead of SIZE > tmp2b.d(6): Integer constant expression expected instead of SIZE > > ----- tmp2.d ----- > > private import tmp2b; > > const int SIZE = 7; > > ----- tmp2b.d ----- > > private import tmp2; > > struct s { > > char a[ SIZE ]; > > } > > Workaround: > Move constant above import of other module. > > ----- tmp2.d ----- > > const int SIZE = 7; > > private import tmp2b; Added to DStress as http://dstress.kuehne.cn/compile/c/const_40_A.d http://dstress.kuehne.cn/compile/c/const_40_B.d http://dstress.kuehne.cn/compile/c/const_40_C.d http://dstress.kuehne.cn/compile/c/const_40_D.d Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFFUfwbLK5blCcjpWoRAvQeAJ4/cIBgs3KXWqmxmsNNN2lCUhiZIQCgrbm+ nWl9Wy0Jv0MX6ivZkD3TnUk= =0Vc/ -----END PGP SIGNATURE-----
Semantics is not yet run on the SIZE identifier, so dmd does not know, it is const. The patch invokes semantics if not yet run. Index: optimize.c =================================================================== --- optimize.c (revision 421) +++ optimize.c (working copy) @@ -47,6 +47,8 @@ Expression *e = NULL; if (!v) return e; + if (!v->originalType && v->scope) // semantic() not yet run - BUG 461 + v->semantic (v->scope); if (v->isConst() || v->isImmutable() || v->storage_class & STCmanifest) {
changeset 480
Fixed DMD1.061 and DMD2.046.
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル