<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/87517>87517</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Clang] Error about use of deleted `operator-` is unnecessarily verbose
</td>
</tr>
<tr>
<th>Labels</th>
<td>
enhancement,
clang:diagnostics
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
Sirraide
</td>
</tr>
</table>
<pre>
This program (https://godbolt.org/z/4z9MKW1xE):
```c++
struct O {
int operator-(O) = delete;
operator bool();
};
void operators() {
O o;
o - o;
};
```
prints
```
<source>:8:5: error: overload resolution selected deleted operator '-'
8 | o - o;
| ~ ^ ~
<source>:2:7: note: candidate function has been explicitly deleted
2 | int operator-(O) = delete;
| ^
<source>:8:5: note: built-in candidate operator-(int, int)
8 | o - o;
| ^
<source>:8:5: note: built-in candidate operator-(int, float)
<source>:8:5: note: built-in candidate operator-(int, double)
<source>:8:5: note: built-in candidate operator-(int, long double)
<source>:8:5: note: built-in candidate operator-(int, __float128)
<source>:8:5: note: built-in candidate operator-(int, long)
<source>:8:5: note: built-in candidate operator-(int, long long)
<source>:8:5: note: built-in candidate operator-(int, __int128)
<source>:8:5: note: built-in candidate operator-(int, unsigned int)
<source>:8:5: note: built-in candidate operator-(int, unsigned long)
<source>:8:5: note: built-in candidate operator-(int, unsigned long long)
<source>:8:5: note: built-in candidate operator-(int, unsigned __int128)
<source>:8:5: note: built-in candidate operator-(float, int)
<source>:8:5: note: built-in candidate operator-(double, int)
<source>:8:5: note: built-in candidate operator-(long double, int)
<source>:8:5: note: built-in candidate operator-(__float128, int)
<source>:8:5: note: built-in candidate operator-(long, int)
<source>:8:5: note: built-in candidate operator-(long long, int)
<source>:8:5: note: built-in candidate operator-(__int128, int)
<source>:8:5: note: built-in candidate operator-(unsigned int, int)
<source>:8:5: note: built-in candidate operator-(unsigned long, int)
<source>:8:5: note: built-in candidate operator-(unsigned long long, int)
<source>:8:5: note: built-in candidate operator-(unsigned __int128, int)
<source>:8:5: note: built-in candidate operator-(float, float)
<source>:8:5: note: built-in candidate operator-(float, double)
<source>:8:5: note: built-in candidate operator-(float, long double)
<source>:8:5: note: built-in candidate operator-(float, __float128)
<source>:8:5: note: built-in candidate operator-(float, long)
<source>:8:5: note: built-in candidate operator-(float, long long)
<source>:8:5: note: built-in candidate operator-(float, __int128)
<source>:8:5: note: built-in candidate operator-(float, unsigned int)
<source>:8:5: note: built-in candidate operator-(float, unsigned long)
<source>:8:5: note: built-in candidate operator-(float, unsigned long long)
<source>:8:5: note: built-in candidate operator-(float, unsigned __int128)
<source>:8:5: note: built-in candidate operator-(double, float)
<source>:8:5: note: built-in candidate operator-(double, double)
<source>:8:5: note: built-in candidate operator-(double, long double)
<source>:8:5: note: built-in candidate operator-(double, __float128)
<source>:8:5: note: built-in candidate operator-(double, long)
<source>:8:5: note: built-in candidate operator-(double, long long)
<source>:8:5: note: built-in candidate operator-(double, __int128)
<source>:8:5: note: built-in candidate operator-(double, unsigned int)
<source>:8:5: note: built-in candidate operator-(double, unsigned long)
<source>:8:5: note: built-in candidate operator-(double, unsigned long long)
<source>:8:5: note: built-in candidate operator-(double, unsigned __int128)
<source>:8:5: note: built-in candidate operator-(long double, float)
<source>:8:5: note: built-in candidate operator-(long double, double)
<source>:8:5: note: built-in candidate operator-(long double, long double)
<source>:8:5: note: built-in candidate operator-(long double, __float128)
<source>:8:5: note: built-in candidate operator-(long double, long)
<source>:8:5: note: built-in candidate operator-(long double, long long)
<source>:8:5: note: built-in candidate operator-(long double, __int128)
<source>:8:5: note: built-in candidate operator-(long double, unsigned int)
<source>:8:5: note: built-in candidate operator-(long double, unsigned long)
<source>:8:5: note: built-in candidate operator-(long double, unsigned long long)
<source>:8:5: note: built-in candidate operator-(long double, unsigned __int128)
<source>:8:5: note: built-in candidate operator-(__float128, float)
<source>:8:5: note: built-in candidate operator-(__float128, double)
<source>:8:5: note: built-in candidate operator-(__float128, long double)
<source>:8:5: note: built-in candidate operator-(__float128, __float128)
<source>:8:5: note: built-in candidate operator-(__float128, long)
<source>:8:5: note: built-in candidate operator-(__float128, long long)
<source>:8:5: note: built-in candidate operator-(__float128, __int128)
<source>:8:5: note: built-in candidate operator-(__float128, unsigned int)
<source>:8:5: note: built-in candidate operator-(__float128, unsigned long)
<source>:8:5: note: built-in candidate operator-(__float128, unsigned long long)
<source>:8:5: note: built-in candidate operator-(__float128, unsigned __int128)
<source>:8:5: note: built-in candidate operator-(long, float)
<source>:8:5: note: built-in candidate operator-(long, double)
<source>:8:5: note: built-in candidate operator-(long, long double)
<source>:8:5: note: built-in candidate operator-(long, __float128)
<source>:8:5: note: built-in candidate operator-(long, long)
<source>:8:5: note: built-in candidate operator-(long, long long)
<source>:8:5: note: built-in candidate operator-(long, __int128)
<source>:8:5: note: built-in candidate operator-(long, unsigned int)
<source>:8:5: note: built-in candidate operator-(long, unsigned long)
<source>:8:5: note: built-in candidate operator-(long, unsigned long long)
<source>:8:5: note: built-in candidate operator-(long, unsigned __int128)
<source>:8:5: note: built-in candidate operator-(long long, float)
<source>:8:5: note: built-in candidate operator-(long long, double)
<source>:8:5: note: built-in candidate operator-(long long, long double)
<source>:8:5: note: built-in candidate operator-(long long, __float128)
<source>:8:5: note: built-in candidate operator-(long long, long)
<source>:8:5: note: built-in candidate operator-(long long, long long)
<source>:8:5: note: built-in candidate operator-(long long, __int128)
<source>:8:5: note: built-in candidate operator-(long long, unsigned int)
<source>:8:5: note: built-in candidate operator-(long long, unsigned long)
<source>:8:5: note: built-in candidate operator-(long long, unsigned long long)
<source>:8:5: note: built-in candidate operator-(long long, unsigned __int128)
<source>:8:5: note: built-in candidate operator-(__int128, float)
<source>:8:5: note: built-in candidate operator-(__int128, double)
<source>:8:5: note: built-in candidate operator-(__int128, long double)
<source>:8:5: note: built-in candidate operator-(__int128, __float128)
<source>:8:5: note: built-in candidate operator-(__int128, long)
<source>:8:5: note: built-in candidate operator-(__int128, long long)
<source>:8:5: note: built-in candidate operator-(__int128, __int128)
<source>:8:5: note: built-in candidate operator-(__int128, unsigned int)
<source>:8:5: note: built-in candidate operator-(__int128, unsigned long)
<source>:8:5: note: built-in candidate operator-(__int128, unsigned long long)
<source>:8:5: note: built-in candidate operator-(__int128, unsigned __int128)
<source>:8:5: note: built-in candidate operator-(unsigned int, float)
<source>:8:5: note: built-in candidate operator-(unsigned int, double)
<source>:8:5: note: built-in candidate operator-(unsigned int, long double)
<source>:8:5: note: built-in candidate operator-(unsigned int, __float128)
<source>:8:5: note: built-in candidate operator-(unsigned int, long)
<source>:8:5: note: built-in candidate operator-(unsigned int, long long)
<source>:8:5: note: built-in candidate operator-(unsigned int, __int128)
<source>:8:5: note: built-in candidate operator-(unsigned int, unsigned int)
<source>:8:5: note: built-in candidate operator-(unsigned int, unsigned long)
<source>:8:5: note: built-in candidate operator-(unsigned int, unsigned long long)
<source>:8:5: note: built-in candidate operator-(unsigned int, unsigned __int128)
<source>:8:5: note: built-in candidate operator-(unsigned long, float)
<source>:8:5: note: built-in candidate operator-(unsigned long, double)
<source>:8:5: note: built-in candidate operator-(unsigned long, long double)
<source>:8:5: note: built-in candidate operator-(unsigned long, __float128)
<source>:8:5: note: built-in candidate operator-(unsigned long, long)
<source>:8:5: note: built-in candidate operator-(unsigned long, long long)
<source>:8:5: note: built-in candidate operator-(unsigned long, __int128)
<source>:8:5: note: built-in candidate operator-(unsigned long, unsigned int)
<source>:8:5: note: built-in candidate operator-(unsigned long, unsigned long)
<source>:8:5: note: built-in candidate operator-(unsigned long, unsigned long long)
<source>:8:5: note: built-in candidate operator-(unsigned long, unsigned __int128)
<source>:8:5: note: built-in candidate operator-(unsigned long long, float)
<source>:8:5: note: built-in candidate operator-(unsigned long long, double)
<source>:8:5: note: built-in candidate operator-(unsigned long long, long double)
<source>:8:5: note: built-in candidate operator-(unsigned long long, __float128)
<source>:8:5: note: built-in candidate operator-(unsigned long long, long)
<source>:8:5: note: built-in candidate operator-(unsigned long long, long long)
<source>:8:5: note: built-in candidate operator-(unsigned long long, __int128)
<source>:8:5: note: built-in candidate operator-(unsigned long long, unsigned int)
<source>:8:5: note: built-in candidate operator-(unsigned long long, unsigned long)
<source>:8:5: note: built-in candidate operator-(unsigned long long, unsigned long long)
<source>:8:5: note: built-in candidate operator-(unsigned long long, unsigned __int128)
<source>:8:5: note: built-in candidate operator-(unsigned __int128, float)
<source>:8:5: note: built-in candidate operator-(unsigned __int128, double)
<source>:8:5: note: built-in candidate operator-(unsigned __int128, long double)
<source>:8:5: note: built-in candidate operator-(unsigned __int128, __float128)
<source>:8:5: note: built-in candidate operator-(unsigned __int128, long)
<source>:8:5: note: built-in candidate operator-(unsigned __int128, long long)
<source>:8:5: note: built-in candidate operator-(unsigned __int128, __int128)
<source>:8:5: note: built-in candidate operator-(unsigned __int128, unsigned int)
<source>:8:5: note: built-in candidate operator-(unsigned __int128, unsigned long)
<source>:8:5: note: built-in candidate operator-(unsigned __int128, unsigned long long)
<source>:8:5: note: built-in candidate operator-(unsigned __int128, unsigned __int128)
```
which is not wrong, but it’s not ideal either... we should not be printing literally every last builtin operator if overload resolution selected a deleted operator.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy8W0uP4jgY_DXm8qlR4gAhBw5MA5fVag670h5bTmLAK3eMbKdneg7z21cJjxAes7uSKy3UPBKqPpddZTsowjm1q6RcsOkXNl2NRO33xi7-UNYKVcpRbsrPxZ975ehgzc6Kd2J8vvf-4FiyZHzD-GZnytxoPzZ2x_jmB-ObyY_s99_-ir-vGc-a06IVi5ZsFh0fBeNfmkf7qfO2Ljx9JZaePiFSlSdzkFZ4Y18Yn39lPCOWrKiUWnrJksuZ57MoN0YzPm_5TkdZuupet_8_jCovX3HH0695v5K5xqaXq_c9tHNLjm8PVlXeXRPdnMCSV2dqW0iWrFmynLNkOWXJkqS1xjYvzIe02oiSrHRG116ZipzUsvCyPDW6K5wYT18YT891Es2Jpa90WzG1f8cjP4lN1_TzYTmcJcu0qa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