<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/62003>62003</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Out of Line Definition Error for Constrained Method of Template Class
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
dev-lunarosa
</td>
</tr>
</table>
<pre>
For the following C++20 code, I am getting an out of line definition error from trunk, which I successfully pulled and compiled just a few hours ago. Clang 16 accepts this code; GCC does as well.
template <typename A>
concept valid = true; // Any concept will do
template <typename T>
class Foo {
template <valid U>
void bar (U baz);
};
template <typename T>
template <valid U>
void Foo<T>::bar (U baz) {
}
Error snippet:
error: out-of-line definition of 'bar' does not match any declaration in 'Foo<T>'
void Foo<T>::bar (U baz) {
^~~
This seems like valid code, so I suspect there is a bug.
Note that either removing the template for class `Foo` and/or removing the constraint from the template method `bar` prevents the error.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUVE2P4ygQ_TX4UuqIxo6dHHxInM5qpP249PwADGWbGUxZgBNlD_PbVzidSbpb2tFwsIWoevUo3isZgukdYs3We7Y-ZHKOA_la4-nJzk56CjJrSV_qI3mIA0JH1tLZuB4aJvZM7AUHRRqZaOALyBF6jDEdSwc0R6AOrHEIGjvjTDTkAL0nD52nEaKf3feUeh6MGuALhFkpDKGbrb3ANFuLGqTToGicTNp8m0MECR2eYaDZB5A9raCx0vXwXIJUCqcYIA4mXHnle_ijaUATBpABzmjtivED47vrFwAg4jhZGRFY3sTLhE6OCDuWv9xD0lLkEjqcpDUaWH5I_JcKTByZOMLOXX4GnY21oOmO8Ityr5_LWRkCHImAVfv3Rx9Rroy-foK4rRMZDa30wMTmK7TyXya2LL-Bsupw3_wu0_-lsdQ9ErG8WbLyHct3H3h8vl3i8_BCL4tegjPThDFBPL7eIiaW75LYnqh7-ig26oCJqpWeieoqAkcRRhnVANJdQKOy0ssl1rgU-0BXVO-J_eZ12Prlx49Htq9JlQFxDGDNd3wT0s0-gRYDhAlVTF7zCCaAhHbu3yn2b4oIcZAR0KQw8DjSKXkuGfTne3Tk3yTESp5IlzxZiYlk5XcpilyIXhoX31z5CDNiHEgnjNTEksPk8YRu8Rhe27_KdJ3rbb6VGdbP5YZvqqra5tlQ640UnRZKye32uRBarNelRsWLddG1uigzUwsucl7w6rkQ23W-klxVSm2qoqy2eVtxVnAcpbEra0_jinyfmRBmrEvBeZ5Z2aINy_ASwuEZlkMmRJplvk45T-3cB1Zwa0IMd5RoosX6n-uE-jOJ5nAXzVVxqYHNrTWo4a9rJ6iD11tzmtTfbPa2HmKcQhLEMgl6E4e5XSkamTimmm-_p8nTN1SRiePCNDBxXG7yXwAAAP__QuazWQ">