[LLVMbugs] [Bug 16550] New: Poor diagnostic when a default argument uses a default initializer that has not been parsed yet

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Jul 5 10:32:10 PDT 2013


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: unassignedclangbugs at nondot.org
          Reporter: richard-llvm at metafoo.co.uk
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20130705/cfba37f3/attachment.html>


More information about the llvm-bugs mailing list