Issue |
134880
|
Summary |
Bogus "constraint depends on itself"
|
Labels |
new issue
|
Assignees |
|
Reporter |
Boris-Rasin
|
```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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs