www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 11221] New: C-style struct literals in associative array literals too

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

           Summary: C-style struct literals in associative array literals
                    too
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc


--- Comment #0 from bearophile_hugs eml.cc 2013-10-10 14:04:33 PDT ---
struct MyStruct {
    int x;
}
void main() {
    MyStruct[string] aa1 = ["A": MyStruct(1),
                            "B": MyStruct(2),
                            "C": MyStruct(3)]; // OK
    MyStruct[string] aa2 = ["A": {1}, "B": {2}, "C" : {3}]; // Error
}


DMD 2.064 alpha gives:

test.d(8): Error: not an associative array initializer

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 10 2013