www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13209] New: Refused union initialization

https://issues.dlang.org/show_bug.cgi?id=13209

          Issue ID: 13209
           Summary: Refused union initialization
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Severity: regression
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: bearophile_hugs eml.cc

This used to work in dmd 2.065:


struct Foo {
    union {
        immutable static struct { double x, y; }
        immutable double[2] v;
    }
    Foo bar() {
        return Foo(y, x);
    }
}
void main() {}


dmd 2.066beta4 gives:

test.d(7,19): Error: more initializers than fields (1) of Foo

--
Jul 26 2014