<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/60231>60231</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Out-of-line definition of member with trailing-requires in template head referring the class is not accepted
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
usx95
</td>
</tr>
</table>
<pre>
https://godbolt.org/z/ns4Kq47o3
```cpp
template<typename T> concept C = true;
template <typename T>
struct Foo {
// Error: Trailing requires to template referring to Foo.
template <typename F> requires C<Foo<T>>
void M1(F f);
// OK: Same but requires attached to decl.
template <typename F>
void M2(F f) requires C<Foo<T>>;
// OK: Same but requires does not refer to `Foo`.
template <typename F> requires C<F>
void M3(F f);
};
template <typename T>
template <typename F> requires C<Foo<T>>
void Foo<T>::M1(F f) {}
template <typename T>
template <typename F>
void Foo<T>::M2(F f) requires C<Foo<T>> {}
template <typename T>
template <typename F> requires C<F>
void Foo<T>::M3(F f) {}
```
fails only for M1 with:
```
error: out-of-line definition of 'M1' does not match any declaration in 'Foo<T>'
void Foo<T>::M1(F f) {}
```
Related issues:
* https://github.com/llvm/llvm-project/issues/49620 but not be a duplicate as the strategy/resolution discussed there is not applicable to trailing requires and only to constrained template parameter.
* https://github.com/llvm/llvm-project/issues/47364 looks more closely related because of trailing requires attached to template head.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysld2OmzgUx5_G3BxNBDYf4YKLNCk3VVVpty9g8CF419jUNu1mn35lSJgkk2l32kojjQL479_5ny_unDxqxIpk70h2iPjke2Oryf1TZlFjxKnqvR8dYTtCa0LroxGNUX5j7JHQ-l9Ca-3SD1_SwjASH0i8I3m8_LXjuDzxOIyKeyRs708jaj4gfCbsPbRGtzh62ANhB_B2QsLenVVuTsL90eW183ZqPdTGACnOBwEWTnhvrbGE7eCz5VJJfQSLXyZp0YE3sCpb7NDa8NqboLS5yDy8uw7Yq86esH1tDGH7memCBfDVSAEfE0K3NXSElmtYAHeUnz4ExD-DdjP5Z2nuPW97FIFKYKt-jHV7N13v_h7urds_hBIGHWjjF9MCGsnjoJjHb7btBTF76RYpDm8riJ_P2cxw_XxH2O4qg3OBFYffwfK9C_9X2n4jy2tJeUzHXrHj0vHLz45L5cBodYLOWPiYwDfp-yDx6Gu8tKmZ_JPpnpTUCAI7qaWXRoPpgNAiZKJ4rr-B-7YHrk9zb3DL50-lDp9eUdPiZ5J7y_cHBuMESOcmDGPw3MGE7uBuMkrfT82mNQOhtVJfL_-eRmv-wtYTWp9FaJ2WOY3n5grhNAgcxDQq2YYkcQe-R3Deco_HE6G1RWfUNAcppGsn58Jk6NEiyMURPs6nG4XzdHsx8rgWS0q8CWM3aEsdRC6VMXLLB_RoN9d19YtRFixPQRnzt4PBWIRWGYfqBPZsaoMtnxyGJD9AvhqBK2aPXJwJI1ExUbKSR1gleZGmWVHGZdRX26xJEiF4U27LXHQNZ9uYJ7TsOHZplueRrGhMWZxQFhdJkpYbpLzdNlkqsk5sGy5IGuPApdqEyMKqi-aYqjymLIkUb1C5eWFSqvHbUhuE0rA_bTW70UxHR9JYSefds4qXXmH16dVKH3Bo0M79shrytBoi9a0P17urD-Zy59Z6aMNmRRFNVt1v8DdkcA74vwAAAP__Q-d-ew">