www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 2096] New: Non-static struct initialization/assingment

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

           Summary: Non-static struct initialization/assingment
           Product: D
           Version: 2.013
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: terranium yandex.ru


struct A
{
        int a,b;
}

void f()
{
        int[4] rgi=[1,2,3,4]; //(1) ok? why?
        A x={1,2}; //(2) ok
        A y={a:1,b:2}; //(3) fail. why?
        x=A(1,2); //(4) ok
        x=A(a:1,b:2); //(5) fail
        x={1,2}; //(6) fail
        x={a:1,b:2}; //(7) fail
}

Why third line doesn't work? And making 5th or 7th line work will be also nice.


-- 
May 11 2008