<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/134880>134880</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Bogus "constraint depends on itself"
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
Boris-Rasin
</td>
</tr>
</table>
<pre>
```cpp
#include <concepts>
struct A
{
template <typename X>
requires requires (A a) { func1<X>(a); }
operator X() const
{
return {};
}
};
template <std::same_as<bool> T>
void func1(int) {}
template <std::same_as<bool> T>
void func1(A) {}
int main()
{
A a;
bool b = a;
return 0;
}
```
Clang 20.1.0
-std=c++20
Compiler Explorer:
https://godbolt.org/z/or9eh7bax
This works with gcc and msvc, but fails with clang:
```
<source>:6:18: error: satisfaction of constraint 'requires (A a) { func1<X>(a); }' depends on itself
```
Instantiating func1<int>() fails, but clang still tries to match the function parameter, as if func1<int>(int) instantiated successfully.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyklMFu4zYQhp9mfBnEkEjbkg46yHYM9FrsYW8FRY0sthSpkqNk06cvKClOujkVaxgQMeR8_P-ZAVWM5u6Iajie4XjdqZkHH-qzDyY-_a6icbvWd281nLL1r6cJsgaENE7buSMEedHeaZo4gnxOe1kTOcyaMS2hOEPWINM4WcXLcX6byKmR8PuagNsv0N-zCRQ_FiDKBhWICqE4Yz87nYO8LGmiTHGQZ4TimiB-oqDYB_wOokwp2rvIG35T8biI5-CWYHEFeX4cui6CtxBkzWfVkTuQDcgmqpH-UBHkpfXegnzGb6uPF2-6TaQojeNN94b9JVrzM8s4xlEZt3r9qDMipoo9PCUotgjy-jmaPlsRss3sCn7v8nrJxSp3R5Ht832KPC2irxrEGcRZvB_y42QsBXz-MVkfKCRfWTMwTzEtxQ3E7e671lve-3AHcfsHxM2HioaiVT9WyrfBRHz14a-Ir4YHvGuNynU4xhcN4oLtzNgrY7dtnZStF_1Hs7xEPwdNqYSyOYFs8hJkgxSCT8IwKjaxV5qNd-j7dUiCSuUEUfz_wRMFdjSR6yJ6h4Yj2f5rIX9zkZVjo9i4-wOXRmQBpnsWc-9OF3sY2ViLHAxFZI-jYj0gD7QAFgOTCmokppASVUTTf4Vvg2geEqjDOGtNMfaztW_7XVfLrpKV2lGdF4dDLvNDWe2GWh9Un5V0JNFrQac8FzqjSlZdSYdcFWJnapGJY3bIyvx0LLNqX1SVPsruJDTptiqOcMhoVMburX0ZU_N3JsaZ6lweyjLbWdWSjcvTI4SjV1x2QYj0EoU6JT218z3CIbMmcvzAsGFL9dnf59Qr8amLX7shxG4Otv5pIA0Pc7vXfgRxS9jt8zQF_ydpBnFbxEQQt03tSy3-DQAA__9F74lj">