<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/101735>101735</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Clang] `requires` clause with parameter pack expansion fails equivalence requirements for out of line definitions
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang:frontend,
concepts,
diverges-from:gcc
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
yuxuanchen1997
</td>
</tr>
</table>
<pre>
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
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy8VcGO4zYM_RrlQsSw5dhODj5knMkeFoseOi3QU8FItK2uLLmSnNnsod9eyE4yg0WAnV5qBI4sPupRjyKF3qvOENWseGLFYYVT6K2rL9O3CY3oyWS7XbU6WXmpfxt9cIQDCI2mAzE5RyboCzj6i0TwEHqC1mptX5XpYHS2cziwfM_SA0v3rEyvv-WT58oIPUkCljfCGkFj8Cx_fmSegtIqXO7WQMOoMcy2cBnJ4EDwcjcLjd7DHlj1tEzAI4ckSeDljRHgbJWEgUJvJePbF894GTHBM767YQAc_T0pR_5tEMEQGN-9I5wfVj1BSO4r-iCjGvm-te4VnWR5s_Dz7cyRJMmyyAH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