[llvm-bugs] [Bug 39933] New: Clang prints incorrect diagnostic notes chain for an implicitly deleted move assignment operator

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Dec 9 17:16:05 PST 2018


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: unassignedclangbugs at nondot.org
          Reporter: orivej at gmx.fr
                CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
                    richard-llvm at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20181210/4abfa80b/attachment.html>


More information about the llvm-bugs mailing list