Similar to issue 23218, but expecting element-wise int-to-float conversion.
---
auto convtest(int[4] a)
{
return cast(__vector(float[4]))a;
}
void main()
{
// AssertError@src/dmd/hdrgen.d(1910): Assertion failure
pragma(msg, convtest([1,2,3,4])[0]);
// ???
//static assert(convtest([1,2,3,4])[0] == 1);
// ???
//assert(convtest([1,2,3,4])[0] == 1);
}
Comment #1 by razvan.nitu1305 — 2023-04-05T14:52:04Z
I cannot reproduce the ICE anymore. I get:
test.d(9): Error: array cast from `int[4]` to `float[4]` is not supported at compile time
test.d(9): while evaluating `pragma(msg, convtest([1, 2, 3, 4])[0])`
test.d(11): Error: array cast from `int[4]` to `float[4]` is not supported at compile time
test.d(11): while evaluating: `static assert((cast(float[4])convtest([1, 2, 3, 4]))[0] == 1.0F)`
It seems that the cast is not supported at ctfe.
Comment #2 by robert.schadek — 2024-12-13T19:23:36Z