[Issue 1914] Array initialisation from const array yeilds memory trample
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Nov 21 03:32:49 PST 2008
http://d.puremagic.com/issues/show_bug.cgi?id=1914
------- Comment #5 from jason at spashett.com 2008-11-21 05:32 -------
(In reply to comment #4)
> It seems that it's simply failing to initialise y correctly. Changing main to
When I looked at the assembly, I think (can't remember now) that y was
initialised, but the array initialisation was overwriting the initialisation of
y.
A note that the values you put into the array i affects the value of y. try the
second struct below, which might give you
C:\temp>dmd test.d
C:\temp>test.exe
1065353216
on windows.
Removing the initialisation from const array does "fix" it though, so this
works:
struct S1
{
float a[10] = [1,1,1,1,1,1,1,1,1,1];
int y=5;
}
but this does not:
struct S1
{
const float[10] i = [1,1,1,1,1,1,1,1,1,1];
float a[10] = i;
int y=5;
}
--
More information about the Digitalmars-d-bugs
mailing list