[Issue 8741] New: [CTFE] Incorrect static array assign results in constructor
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Sep 30 16:41:58 PDT 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8741
Summary: [CTFE] Incorrect static array assign results in
constructor
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Severity: major
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: peter.alexander.au at gmail.com
--- Comment #0 from Peter Alexander <peter.alexander.au at gmail.com> 2012-09-30 16:42:16 PDT ---
struct Vec2
{
this(float x)
{
m[0] = x;
m[1] = x;
}
float[2] m;
static Vec2 zeroes = Vec2(0);
}
void main()
{
import std.stdio;
writeln(Vec2.zeroes);
}
Output is:
Vec2([0, nan])
http://dpaste.dzfl.pl/77058efc
Using two parameters for the constructor makes the bug go away:
http://dpaste.dzfl.pl/7ea20ba0
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list