www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - Weird static assert behavior

reply tetsuya <tetsuya_member pathlink.com> writes:
The static assert does inconsistent behavior on dmd0.129, winXP.

<code>
class XXX(int L)
{
static assert(L > 0);             // passes on compilation (should fail
static this() { assert(L > 0); }  // fails on execution
}
void main() { alias XXX!(-1) xxx; }
</code>

cheers,
Sep 01 2005
next sibling parent =?UTF-8?B?VGhvbWFzIEvDvGhuZQ==?= <thomas-dloop kuehne.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

tetsuya schrieb:

 The static assert does inconsistent behavior on dmd0.129, winXP.
 
 <code>
 class XXX(int L)
 {
 static assert(L > 0);             // passes on compilation (should fail
 static this() { assert(L > 0); }  // fails on execution
 }
 void main() { alias XXX!(-1) xxx; }
 </code>
Added to DStress as http://dstress.kuehne.cn/nocompile/a/assert_11_A.d http://dstress.kuehne.cn/nocompile/a/assert_11_B.d http://dstress.kuehne.cn/nocompile/a/assert_11_C.d http://dstress.kuehne.cn/nocompile/a/assert_11_D.d Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFDH2W43w+/yD4P9tIRAqIeAJ9iNcW5uRmjPb9o3HMjSiuTvVxpnQCgre9k nk3TxfM+gEO6pVKXRfSXwCY= =xEFM -----END PGP SIGNATURE-----
Sep 07 2005
prev sibling parent "Walter Bright" <newshound digitalmars.com> writes:
That's the old const folding problem. It's fixed.
Sep 10 2005