[Issue 9425] Static struct initializer fails to init array

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Feb 2 05:49:36 PST 2013


http://d.puremagic.com/issues/show_bug.cgi?id=9425



--- Comment #2 from Kenji Hara <k.hara.pg at gmail.com> 2013-02-02 05:49:34 PST ---
(In reply to comment #1)
> This is related to Bug2931. There's a dmd testcase for that in
> http://github.com/D-Programming-Language/dmd/blob/e7eff4deef0fb5ec9a89cee4716785832fc41fb9/test/runnable/test42.d#L3193
> . The actual test case bug2931_2 conflicts with what I expected it to assert:
> Only the first element is initialized with the value, all other elements are
> assumed to be zero.
> This however contradicts dmd's behavior for the non-static case.

For the one level block initializing of static array, current dmd generates
correct code.

static int[3] x = 1;  // block initializing
void main() {
    import std.stdio;
    writeln(x); // print [1, 1, 1];
}

It is from dmd0.98.
https://github.com/d-programming-language/dmd/commit/15d4546d07d5dedb7424677ae4dc0b18e57ef6da#L11R799

So, the test case for bug 2931 is wrong, IMO.

-- 
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