http://llvm.org/bugs/show_bug.cgi?id=16550

            Bug ID: 16550
           Summary: Poor diagnostic when a default argument uses a default
                    initializer that has not been parsed yet
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]
    Classification: Unclassified

struct A
{
    struct B
    {
        int i = 0;
    };

    B b;

    A(const B& _b = B())
        : b(_b)
    {}
};

test.cpp:11:21: error: defaulted default constructor of 'B' cannot be used by
non-static data member initializer which appears before end of class definition
    A(const B& _b = B())
                    ^

This diagnostic is not correct. We should really say something more like:

test.cpp:5:17: error: non-static data member initializer used within class
definition
        int i = 0;
                ^
test.cpp:11:21: note: implicitly used by use of defaulted default constructor
for 'B' in default argument here
    A(const B& _b = B())
                    ^

(We should probably wait until we have wording for core issue 1607 before
proceeding here; it's not entirely clear exactly what the rules will be yet.)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to