Static initialization from Struct literals

Sebastian Graf SebastianGraf at t-online.de
Tue May 14 20:30:08 PDT 2013


Hi,

in my attempt to fix #265 
(http://github.com/ldc-developers/ldc/pull/275), I transitively 
had to fix other things related to static initialization of 
structs and arrays. Unfortunately, I hit a wall today when I 
thought I just had it. Consider:

struct S { int array[4]; }

void main()
{
     S local = S(67); // local.array = [67, 67, 67, 67]
     static S static_ = S(67); // static_.array = [67, 0, 0, 0]
     assert(local == static_);
}

This passes in my current ldc commit, but fails for the current 
releases of dmd and ldc2, with values as commented. I could have 
lived with a bug and filed a bug report 
http://d.puremagic.com/issues/show_bug.cgi?id=9425 , but was 
baffled again when the ldc build test suite failed at 
http://github.com/D-Programming-Language/dmd/blob/e7eff4deef0fb5ec9a89cee4716785832fc41fb9/test/runnable/test42.d#L3223. 
How should I proceed? Just try to unfix it as expected in that 
test case, wait for a fix or try another issue instead?


More information about the digitalmars-d-ldc mailing list