[llvm-bugs] [Bug 28741] New: Clang gives poor warnings messages on implicitly-deleted explicitly-defaulted move assignment operator (and others) - gcc warnings much better

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jul 27 14:24:28 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=28741

            Bug ID: 28741
           Summary: Clang gives poor warnings messages on
                    implicitly-deleted explicitly-defaulted move
                    assignment operator (and others) - gcc warnings much
                    better
           Product: clang
           Version: 3.8
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: xaxxon at gmail.com
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
    Classification: Unclassified

#include <utility>
#include <vector>
using namespace std;

struct A {
  int& x;
  A(A&&)=default;
    A& operator=(A&&) = default;
  A(int& x) : x(x) { }
};

vector<A> avec;

int main() {
 avec.erase(avec.begin());
}

Live: https://godbolt.org/g/uiXrpK

GCC says:  
8 : note: 'A& A::operator=(A&&)' is implicitly deleted because the default
definition would be ill-formed:
A& operator=(A&&) = default;


Clang says: !!note: copy assignment operator is implicitly deleted because 'A'
has a user-declared move constructor
8


Clang doesn't even mention your move assignment being deleted, it just skips
straight to the copy assignment not being available.

-- 
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/20160727/087259ab/attachment.html>


More information about the llvm-bugs mailing list