[Issue 20041] New: CTFE incorrect result with __vector
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Jul 10 19:48:55 UTC 2019
https://issues.dlang.org/show_bug.cgi?id=20041
Issue ID: 20041
Summary: CTFE incorrect result with __vector
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Severity: major
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: thomas.bockman at gmail.com
import std.stdio;
struct Vec3Fast {
__vector(float[4]) raw;
this(const(float[3]) value...) inout pure @safe nothrow @nogc {
__vector(float[4]) raw;
raw[0 .. 3] = value[];
raw[3] = 0.0f;
this.raw = raw;
}
}
void main() {
static immutable Vec3Fast v = Vec3Fast( 1.0f, 2.0f, 3.0f );
static foreach(d; 0 .. 4)
write(v.raw[d], " ");
}
With CTFE, the above prints "nan nan nan nan ", which is wrong. If I remove the
`static immutable`, it prints "1 2 3 0" as it should.
--
More information about the Digitalmars-d-bugs
mailing list