<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - Clang prints incorrect diagnostic notes chain for an implicitly deleted move assignment operator"
href="https://bugs.llvm.org/show_bug.cgi?id=39933">39933</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Clang prints incorrect diagnostic notes chain for an implicitly deleted move assignment operator
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Frontend
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>orivej@gmx.fr
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>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 <a href="https://reviews.llvm.org/rL343285">https://reviews.llvm.org/rL343285</a> 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.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>