<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/64530>64530</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Explicitly default special member functions with qualifiers not always rejected
</td>
</tr>
<tr>
<th>Labels</th>
<td>
c++20,
clang:frontend,
quality-of-implementation,
accepts-invalid
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
AaronBallman
</td>
</tr>
</table>
<pre>
https://github.com/llvm/llvm-project/blob/247cc265e74e25164ee7ce85e6c9c53b3d177740/clang/lib/Sema/SemaDeclCXX.cpp#L7720 is looking for `const` and `volatile` qualifiers explicitly when it really should be looking for any qualifiers on the method. For example:
```
struct R {
R& operator=(const R&) volatile = default; // Correctly diagnosed
};
struct S {
S& operator=(const S&) const = default; // Correctly diagnosed
};
struct T {
T& operator=(const T&) __restrict = default; // Silently accepted
};
struct U {
U& operator=(const U&) _Nonnull = default; // Silently accepted
};
```
https://godbolt.org/z/7qaj77qPo
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyklEFvrDYQxz-NuVi7Mjbg5cBhN1tOVVW9TaR3ezJmWPw62MQ2SbafvoIlySZVVLWVkKwZM_4Nf_wfFYI5W4CK5AeSHxM1xd75aq-8sweFOCibNK69VH2MYyBiT3hNeH02sZ-arXYD4TXi0-uyGb37CToSXjfoGsJrnkmteZGDzIDnaZEBSA27HApd6lw0ok2llBkjvNao7Hk-yMyFJxjUuhxB493371s9joSLX6XkjJpA0bk_jD3TznlKCqadDZEUjCrbzvGTQxUNwpx6nBSazoAPFF5GNNpEvNDnHiw1kXpQiBcaejdhSxv4cLKyl9tyZ2nsgQ4Qe9duae08hRc1jAizOOxI2J4UbH2WMEQ_6Ui_USIP1wyl3wgvqBvBq-g8EUfCd0v7ywbhJX1tnhJxpC10asJIxIFe5ad3znvQ8ze0Rp2tC9CubHkkYsV8wJ9u8aev8KcVf40-sf87_P4Wfv8V_H6F__jhIURv9N86WBs4GQQ785XWMMZ_xD_c4h--wj-84n9z1k6I_wP-8QJ8so5rG4dx6_x81_8kvJaP6qeUj7-7pK1EW4pSJVClRZnmjJc5S_pql3Zp2bK2K5oOtJJ8l4ssBanyPIM0yxJTccYF27FdKvI8K7eNLHRRCiY4aCG5JBmDQRnczi6d2YkJYYKqyHLBElQNYFhmAOea8APhB84I54TfzZnFmGLfeWcj2PZtY_FFvGxctzGzBQawUUXj7NsbV5HCxtgnhWapzI-Jr5Zh0UznQDKGJsTw3lg0EaH65d2m6z-gYQRtFNIBhgY87SarZ1agzyb2tx61LlKFz-oSqId5HEGbTB7__QxbNAqE14tMfwUAAP__D6qX8w">