www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - assert() doesn't convert floating point literals of mixed type correctly

reply Don Clugston <dac nospam.com.au> writes:
AFAICT, it only applies to assert().
Even static assert() works correctly.

void main()
{
    bool q = (0.9 + 3.5L == 0.9L + 3.5L);
    assert(q); //ok
    static assert(0.9 + 3.5L == 0.9L + 3.5L); //ok
    assert(0.9 + 3.5L == 0.9L + 3.5L);  // fails!
}
Jan 13 2006
parent Thomas Kuehne <thomas-dloop kuehne.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Don Clugston schrieb am 2006-01-13:
 AFAICT, it only applies to assert().
 Even static assert() works correctly.

 void main()
 {
     bool q = (0.9 + 3.5L == 0.9L + 3.5L);
     assert(q); //ok
     static assert(0.9 + 3.5L == 0.9L + 3.5L); //ok
     assert(0.9 + 3.5L == 0.9L + 3.5L);  // fails!
 }

Added to DStress as http://dstress.kuehne.cn/run/a/assert_12_A.d http://dstress.kuehne.cn/run/a/assert_12_B.d http://dstress.kuehne.cn/run/a/assert_12_C.d Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFDyjAl3w+/yD4P9tIRAhFcAKCZ/Ddfi495vftKmFz3MczHvv7McQCgxagx z5rR0zj4ClvkbfoF4XRdS8Y= =THQp -----END PGP SIGNATURE-----
Jan 15 2006