<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/110224>110224</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
clang-19 unconditionally sets `__cpp_deleted_function`
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
mpusz
</td>
</tr>
</table>
<pre>
`__cpp_deleted_function` should be set only for C++26 and higher. It is set even for C++20 now (https://godbolt.org/z/T7Ph3E4fz), which makes the following code:
```cpp
[[nodiscard]] friend consteval Unit auto operator*(Unit auto, Magnitude auto)
#if __cpp_deleted_function
= delete("To scale a unit use `mag * unit` syntax");
#else
= delete;
#endif
```
result in the following error on C++20 build:
```text
unit.h:154:14: error: '= delete' with a message is a C++2c extension [-Werror,-Wc++26-extensions]
154 | = delete("To scale a unit use `mag * unit` syntax");
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysVM9v6zYM_mvoC5FApn_FBx-a5gXYYcAOb3jHQpZoW5siGZbctD3sbx-UpF0XrMMOEwzaoOjvoz6SkiGY0TF3UO2hOmRyjZNfutO8hres9_q1g1o8Pal5ftJsObJ-GlanovEOaoFh8qvV2DMGjuidfcXBL_gItAfaU43SaZzMOPGyxZ8imnAJ5Gd2fwsU6PwZgXZTjHOA4gHoCHQcve69jVu_jEDHN6Dj9-aXqfhWDm9ALdAjniejJjzJ3zlgnBgHb60_Gzei8poTkDiAeLe1uD5qnq8exMu5985rE5RcNFQHqA44LIadRuVdiPwsLf7qTES5Ro9-5kVGvwA9AO0-_CmZn-XoTFw13zztjZYKM-AXIt7SQITigNddoB0QffcYlLSMEtdEsgZGqMVJjgj0cPFdKvDqonwBokRX7D8Y2Qb-R_DPMU6b4U6az3otHFYb0bg7aXlZ_ILefSpfvxqrv5I78ku8ulLW2wmKh7wqk03mCpc-gJrPKjR4NnFCiScOQY6cukd-cCrkl8guGO9SETc_rjD0uPmh3ttv8xESUmHf5cirEqF5xP9bdryuBA3Vtz_-47oTK9NdoduilRl3eUNNSW1eNdnUKZE3dVvn1OxkIcqBKa9UXRXtTrSi4T4zHQkqRUuNaKmqmq3SZa2bahiKQmiRD1AKPkljt9Y-n9JQZSaElbs8F0RlZmXPNlxuAiLHZ7zspjNWh2zp0k-bfh0DlMKaEMNfMNFEy52y0o2bvMXVKe-0Sf0trX1NIx_w3-6RbF1sdzf6Jk5rv1X-BHRMRLfXZl78b6wi0PGSXgA63vJ_7ujPAAAA__8arngv">