June 01, 2019 [Issue 19932] New: ICE: compiler crashes when reading ifloat/idouble as uint/ulong during CTFE | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=19932 Issue ID: 19932 Summary: ICE: compiler crashes when reading ifloat/idouble as uint/ulong during CTFE Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nobody@puremagic.com Reporter: n8sh.secondary@hotmail.com Example: ---- auto getBits(U, T)(const T value) if (T.sizeof == U.sizeof && T.alignof >= U.alignof && __traits(isUnsigned, U)) { return *cast(U*) &value; } void main() { const floatBits = getBits!(uint, float)(1.0f); // fine const doubleBits = getBits!(ulong, double)(1.0); // fine const ifloatBits = getBits!(uint, ifloat)(1.0i); // fine const idoubleBits = getBits!(ulong, idouble)(1.0i); // fine enum ctfeFloatBits = getBits!(uint, float)(1.0f); // fine enum ctfeDoubleBits = getBits!(ulong, double)(1.0); // fine //enum ctfeIFloatBits = getBits!(uint, ifloat)(1.0i); // crashes compiler //enum ctfeIDoubleBits = getBits!(ulong, idouble)(1.0i); // crashes compiler } ---- -- |
Copyright © 1999-2021 by the D Language Foundation