<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 - Missing -Wdeprecated warning when user-declared copy assignment operator is defined as deleted"
href="https://bugs.llvm.org/show_bug.cgi?id=45634">45634</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Missing -Wdeprecated warning when user-declared copy assignment operator is defined as deleted
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>All
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</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>-New Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>arthur.j.odwyer@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>// <a href="https://godbolt.org/z/vmKAwd">https://godbolt.org/z/vmKAwd</a>
struct S {
int i;
S& operator=(const S&) = delete;
};
S test(const S& s) { return S(s); }
"clang++ -Wdeprecated test.cc" (incorrectly) does not emit a warning for this
code.
It will (correctly) emit a warning if you remove the tokens "= delete" from the
user-provided declaration.
<a href="http://eel.is/c++draft/class.copy.ctor#6">http://eel.is/c++draft/class.copy.ctor#6</a> :
<span class="quote">> If the class definition does not explicitly declare a copy constructor, a non-explicit one is declared implicitly. If the class definition declares a move constructor or move assignment operator, the implicitly declared copy constructor is defined as deleted; otherwise, it is defined as defaulted ([dcl.fct.def]). The latter case is deprecated if the class has a user-declared copy assignment operator or a user-declared destructor ([depr.impldec]).</span >
S's deleted copy assignment operator counts as a user-declared copy assignment
operator; therefore we're in the deprecated case; therefore Clang should warn.
(So says #standardese on Slack, anyway.)</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>