[LLVMbugs] [Bug 11410] New: Confusing diagnostic when trailing array element tries to call deleted default constructor

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun Nov 20 09:56:41 PST 2011


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

             Bug #: 11410
           Summary: Confusing diagnostic when trailing array element tries
                    to call deleted default constructor
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++0x
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: jyasskin at google.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


$ cat test.cc
struct DeletedDefaultConstructor {
    DeletedDefaultConstructor() = delete;
    int v;
};

void foo() {
    DeletedDefaultConstructor ddc[3] = {{1}, {2}};
}
$ clang++ -fsyntax-only -std=c++0x test.cc
test.cc:7:40: error: call to deleted constructor of 'DeletedDefaultConstructor'
    DeletedDefaultConstructor ddc[3] = {{1}, {2}};
                                       ^
test.cc:2:5: note: function has been explicitly marked deleted here
    DeletedDefaultConstructor() = delete;
    ^
1 error generated.



I think the error message should
 a) point at the trailing '}' in the array definition, not the leading one, and
 b) mention that the initializer list was shorter than the array, so it was
generating implicit calls to the default constructor to initialize the rest of
the elements.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list