<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/56481>56481</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Invalid ambiguous overload with _simple-requirement_ on a closure
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
JohelEGP
</td>
</tr>
</table>
<pre>
See https://godbolt.org/z/P1acGEh6K.
```C++
template<class...> struct unit { };
template<class T> concept unit_type =
#if 1
requires { [](unit<>) {}(T{}); };
#else // Fixes Clang.
requires(void (f)(unit<>)) { f(T{}); };
#endif
template<class> concept unit_prefix = true;
template<class> concept unit_suffix = true;
template<unit_prefix, unit_type> struct prefixed_unit { };
template<unit_type, unit_suffix> struct suffixed_unit { };
template<unit_prefix L, unit_type R> prefixed_unit<L, R> operator*(L, R) { return {}; }
template<unit_type L, unit_suffix R> suffixed_unit<L, R> operator*(L, R) { return {}; }
struct square { };
struct metre : unit<> { };
// static_assert(not unit_type<square>); // Fixes Clang.
auto sqm = square() * metre{};
```
```
<source>:22:21: error: use of overloaded operator '*' is ambiguous (with operand types 'square' and 'metre')
auto sqm = square() * metre{};
~~~~~~~~ ^ ~~~~~~~
<source>:16:58: note: candidate function [with L = square, R = metre]
template<unit_prefix L, unit_type R> prefixed_unit<L, R> operator*(L, R) { return {}; }
^
<source>:17:58: note: candidate function [with L = square, R = metre]
template<unit_type L, unit_suffix R> suffixed_unit<L, R> operator*(L, R) { return {}; }
^
1 error generated.
Compiler returned: 1
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy9Vktz2yAQ_jXowkRjgWVJBx0cx-m0zaHT9u5B0sqmg4ULKE3767sgOX7EbmfShwY9YNndbz92QZVuvpefAOjGuZ0lfE7YPba1biqtXKzNGns_8P6QiPrNcjN7H5PJHZnMyWwytAVht76FUQfbnRIOCF_USlgbxzHhS2qd6WtH-046SrJbvO8IH1UuK9LPXq_WXQ27QXHlvu-AEn43qjEuW5oMHUoNfO2lATuYT29JekdY7vXQIpoirPAi75jln_dfBaI4BcM4KItuAgv0Xj6hyYUS3To-94R2HrVscGreektn3kaHtP2tv66R7a-oeEHEzkArnzwVFHmFZ2O_VbR9e1HxhfqRG8IWB_qP1nKQQrO6uKjntoLy3tIA48jWMHDN1q_Q0YcTfPSjt3oCDeeHOUGid2CE04YwZD4fx8eFMuB60-2TZFynq8EcOR5ZDQ5OIvkLrofnnqavvTDwgp9RugXnhXxOD3n4ksshr60TTtYrzBEwDuF02h0v8mLwNCayx3OtHETvNOLahpwatVge4mLzAdJzVGf7xuUu-ta9qYNvPmfMPxIfFBiD5PnosDx1S_UjGKVFA80ztegzC_RmVFoqtpVc97q3vkK_SbcZ5nUN9UH60WwPOKN-GN8DYG-leG189HCRbHmx4f60vCK8REIyw0ea-9hxncC_a8QrG0xJ2vZd7aTu_J4Xgnw4gYpJFvoD0vRKQv_HWqKvvZCzy-xk_5qd_1juf85OMhQKXUPnAUAzFupCb3dSgRmdQ-OJSs5qMGpK3hS8EJGTTkH5tnsUCo-4Qyntq44GNldWIlVwMx6JW-jciiLbgtZK295A1BtVnv1ZoGJfxbXeYkepx_3rZmf0F6hxN7qX1vb-fL1PZ9M8iTZlklZ5xnnBM9G0rJiyCa8AptOiSFjB01mkRIXHdunPfcY6-EaDCfzGRY1kySaMTbIkYSxJ0zzO2knFWNG2gqcsz1IyncBWSBV7HP6XJzJlgFT1a4tCJa2zByHumnLdAZTDb0aEe8RGm_Kd3oBavvkQBd9lwP4Tnh63dw">