www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 15691] New: Improve error message for struct member initializer

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

          Issue ID: 15691
           Summary: Improve error message for struct member initializer
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: doob me.com

struct Foo { int a; int b; }

void main()
{
    Foo z = { // line 5
        a: 3,
        c: 4 // line 7
    };
}

The above code will result in the following error message:

main.d(5): Error: 'c' is not a member of 'Foo'

It would be better if the error message mentioned line 7 where the actual error
is, either instead of line 5 or in addition to it.

--
Feb 16 2016