March 21, 2005
Using DMD 0.118, Windows 98SE.

Something similar to this was reported before, and I've a recollection of hearing this was fixed, but maybe I was imagining it.  But something's changed - using a whole const struct in a static initialiser now works, but using a member of one doesn't.

----------
struct Qwert { int yuiop; }
struct Asdfg { int hjkl; }
struct Zxcvb { Asdfg nm; }

const int qaz = 15;
const Qwert wsx = { qaz };
const Asdfg edc = { wsx.yuiop };
const Zxcvb rfv = { edc };
int tgb = rfv.nm.hjkl;
----------
D:\My Documents\Programming\D\Tests\bugs\init_struct.d(7): non-constant expression *(&wsx)
D:\My Documents\Programming\D\Tests\bugs\init_struct.d(7): non-constant expression *(&wsx)
D:\My Documents\Programming\D\Tests\bugs\init_struct.d(9): non-constant expression *(&rfv)
----------

Stewart.


-- 
My e-mail is valid but not my primary mailbox.  Please keep replies on the 'group where everyone may benefit.
March 22, 2005
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Stewart Gordon schrieb am Mon, 21 Mar 2005 11:45:30 +0000:
> Using DMD 0.118, Windows 98SE.
>
> Something similar to this was reported before, and I've a recollection of hearing this was fixed, but maybe I was imagining it.  But something's changed - using a whole const struct in a static initialiser now works, but using a member of one doesn't.
>
> ----------
> struct Qwert { int yuiop; }
> struct Asdfg { int hjkl; }
> struct Zxcvb { Asdfg nm; }
>
> const int qaz = 15;
> const Qwert wsx = { qaz };
> const Asdfg edc = { wsx.yuiop };
> const Zxcvb rfv = { edc };
> int tgb = rfv.nm.hjkl;
> ----------
> D:\My Documents\Programming\D\Tests\bugs\init_struct.d(7): non-constant
> expression *(&wsx)
> D:\My Documents\Programming\D\Tests\bugs\init_struct.d(7): non-constant
> expression *(&wsx)
> D:\My Documents\Programming\D\Tests\bugs\init_struct.d(9): non-constant
> expression *(&rfv)
> ----------

Added to DStress as
http://dstress.kuehne.cn/run/const_15.d
http://dstress.kuehne.cn/run/const_16.d

Thomas


-----BEGIN PGP SIGNATURE-----

iD8DBQFCP8Np3w+/yD4P9tIRAviaAJ9GsbvGuk+eOPw5IURUGZ0DBr2e+gCcDDHI
drxN6I6+HlFAcGTgR5yoPcc=
=2VOF
-----END PGP SIGNATURE-----