Issue 76415
Summary [clang] Different behavior between SFINAE and requires
Labels clang
Assignees
Reporter 16bit-ykiko
    See code below:
```c++
struct Any
{
    template<typename T> requires std::is_copy_constructible_v<T>
    operator T();
};
static_assert(std::is_copy_constructible_v<Any>);
```
Obviously, the type Any can be copy constructible. But clang17 reject the code.
If I modify it to the equivalent form of SFINAE:
```c++
struct Any
{
 template<typename T, typename = std::enable_if_t<std::is_copy_constructible_v<T>>>
    operator T();
};
static_assert(std::is_copy_constructible_v<Any>);
```
then it can work. The test code is at [godbolt](https://godbolt.org/z/zajsjna7b),
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to