www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 15340] New: Spurious "overlapped default initialization"

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

          Issue ID: 15340
           Summary: Spurious "overlapped default initialization" errors
                    with auto fields
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: diagnostic
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: k.hara.pg gmail.com

Test case:

module test;
class C
{
    auto a = undef1;
    auto b = undef2;
}

`dmd -o- test` prints:

test.d(4): Error: undefined identifier 'undef1'
test.d(5): Error: undefined identifier 'undef2'
test.d(2): Error: overlapping default initialization for field b and a
test.d(2): Error: overlapping default initialization for field a and b

The last two errors should not be reported.

--
Nov 14 2015