[Bug 33] No short-circuit evaluation for compile-time expressions?

Thomas Kuehne thomas-dloop at kuehne.cn
Tue Mar 21 02:48:24 PST 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

d-bugmail at puremagic.com schrieb am 2006-03-13:
>
> And this one gives a quite bizarre error message:
>
> void main()
> {
>     const char [] s = (int*).mangleof;
>     static if( s.length > 1 && s[2] == 'x' )
>         printf( "'x' as second char\n" );
> }
>
> something about TOK58 doesn't evaluate to a boolean.

The code above is buggy. s="ab" will result in an  ArrayBoundsError.

Added to DStress
http://dstress.kuehne.cn/run/m/mangleof_15_A.d
http://dstress.kuehne.cn/run/m/mangleof_15_B.d
http://dstress.kuehne.cn/run/m/mangleof_15_C.d
http://dstress.kuehne.cn/run/m/mangleof_15_D.d

Thomas


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

iD8DBQFEH+AF3w+/yD4P9tIRAic1AKCSrOmy1GOb0Lsry6wfLQ2H7b/IFQCgvDT9
BPkzHqg8uz8ZkR+y3x+WD3g=
=dpwQ
-----END PGP SIGNATURE-----



More information about the Digitalmars-d-bugs mailing list