Issue 101735
Summary [Clang] `requires` clause with parameter pack expansion fails equivalence requirements for out of line definitions
Labels clang:frontend, concepts, diverges-from:gcc
Assignees
Reporter yuxuanchen1997
    Upstream clang currently rejects the following program:
```
#include <concepts>
#include <utility>
template <typename T>
class A {
 template <typename... Ts>
  void method(Ts&... ts)
    requires requires (T t) {
      { t.method(std::forward<Ts>(ts)...) } -> std::same_as<void>;
    };
};
template <typename T>
template <typename... Ts>
void A<T>::method(Ts&... ts)
  requires requires (T t) {
    { t.method(std::forward<Ts>(ts)...) } -> std::same_as<void>;
  } {}
```
The error message is: 
```
test.cc:15:12: error: out-of-line definition of 'method' does not match any declaration in 'A<T>'
   15 | void A<T>::method(Ts&... ts)
      | ^~~~~~
1 error generated.
```
After getting rid of the `std::forward<Ts>(ts)...`, the error went away. 
On an older clang (17-18) this caused a crash with the backtrace. GCC and MSVC accepted this program. 

Godbolt: https://godbolt.org/z/YoKM3bzvK

_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to