[Issue 19932] New: ICE: compiler crashes when reading ifloat/idouble as uint/ulong during CTFE
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Jun 1 22:16:17 UTC 2019
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 at puremagic.com
Reporter: n8sh.secondary at 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
}
----
--
More information about the Digitalmars-d-bugs
mailing list