[LLVMbugs] [Bug 10217] New: Confusing error message with deleted implicit copy constructors/assignment operators

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Jun 28 03:15:32 PDT 2011


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

           Summary: Confusing error message with deleted implicit copy
                    constructors/assignment operators
           Product: clang
           Version: trunk
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++0x
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: jonathan.sauer at gmx.de
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


Consider the following code (adapted from libc++):

template <class _T1, class _T2>
struct __compressed_pair
{
    __compressed_pair() {}
    __compressed_pair(__compressed_pair&&) {}
};

typedef __compressed_pair<int, int>    P;

P foo();

int main(int, char**)
{
    P s;
    s = foo();
}


Compiling this with clang r133996 results in:

$ clang -std=c++0x clang.cpp
clang.cpp:15:4: error: overload resolution selected deleted operator '='
        s = foo();
        ~ ^ ~~~~~
clang.cpp:2:8: note: candidate function (the implicit copy assignment operator)
has been explicitly
      deleted
struct __compressed_pair
       ^
1 error generated.


This behaviour is correct as per 12.8p18, however the error message is quite
confusing: How can an *implicit* operator be *explicitely* deleted? I think the
note should end with "... by the explicit move {constructor|assignment
operator}". Also, it should point to this move constructor/operator instead of
to the beginning of the class definition.

-- 
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