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

            Bug ID: 39933
           Summary: Clang prints incorrect diagnostic notes chain for an
                    implicitly deleted move assignment operator
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangb...@nondot.org
          Reporter: ori...@gmx.fr
                CC: llvm-bugs@lists.llvm.org, neeil...@live.com,
                    richard-l...@metafoo.co.uk

Consider the following code:

struct A { A& operator=(A&&); };
struct B { B(B&&); };
//struct B { B(B&&); B& operator=(B&&); };
struct C { A a; B b; };
struct D { C c; D& operator=(D&&) = default; };

Since https://reviews.llvm.org/rL343285 it triggers
-Wdefaulted-function-deleted: operator=(D&&) can not be defaulted because
operator=(B&&) is missing. (The fix is to use the commented out definition of
B.) However, Clang prints:

x.cpp:5:20: warning: explicitly defaulted move assignment operator is
implicitly deleted [-Wdefaulted-function-deleted]
struct D { C c; D& operator=(D&&) = default; };
                   ^
x.cpp:5:14: note: move assignment operator of 'D' is implicitly deleted because
field 'c' has a deleted move assignment operator
struct D { C c; D& operator=(D&&) = default; };
             ^
x.cpp:4:14: note: copy assignment operator of 'C' is implicitly deleted because
field 'a' has a deleted copy assignment operator
struct C { A a; B b; };
             ^
x.cpp:1:15: note: copy assignment operator is implicitly deleted because 'A'
has a user-declared move assignment operator
struct A { A& operator=(A&&); };
              ^

All these diagnostics are true, but the "copy assignment operator of 'C' is
implicitly deleted" and the following are irrelevant, since what D needs from C
is a move assignment operator. The diagnostics do not even mention the culprit
B.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to