<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/55216>55216</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Clang does not see class member in a 'requires'.
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
EdvinVikstrom
</td>
</tr>
</table>
<pre>
Tested with clang-trunk.
Here's the code:
```
template<typename T>
class Test {
public:
static constexpr int val = 16;
constexpr Test()
requires (val == 16);
};
template<typename T>
constexpr Test<T>::Test() // error: out-of-line definition of 'Test<T>' does not match any declaration in 'Test<T>'
requires (val == 16) // error: use of undeclared identifier 'val'
{
}
int main()
{
Test<int> test();
return 0;
}
```
I tested with GCC and it gives no errors.
Replacing `val == 16` with `Test<T>::val == 16` removes the 'undeclared identifier...' error but 'out-of-line...' error remains.
With no template parameters the code compiles if you write `Test::val == 16`.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyNVMGOmzAQ_RpzGQURAyEcOOwmu22v1ao9G5gk7oJNbZNt_r5jhyyJElVFyDGa8Zs3741T6_ZUvaF12MKHdAdoOqH2C2dG9R6zZMuSp69okPHCgjsgNLpFlj6dI2yVTG_4dNgPnXAU37jTgEr0CG8sfTlHCdha8KWAFc8TQFiHse5kM6OGFeixTjjZUE1F_P4MBqRycBQdsHQLyxVLn-fceTen-2KMrxkv56h_DP4epUELFJzgJkTKvICyYjvv_6e_27LpJoSoqfRp5kEVX-kFNEYbioAe3ULvFp1UCC3upJJOagV6R5nFNRAvoNVEWWkHvXDNAYQ60RGS1YhwRqr7M3Pf_-r5jtVo0VMY1RmfZkO2qJzcSTS-CAF8gs9mkmBXanmveiHVtQGfuZ7RxJTyiCu42atrWw260ShIbmx5NHzn9VvAuczyl82GVCLyDvbyGMQ792in0f6OZGgj1R4I51aVVXLGoM2dn3eZBnvt8f0NIWEe6hbHsTcx1Id6dD7xyv2bMOGRcheWPz0Pon6ZPxjI8h4dmvlO0tIPsiMOcgcnPcKHkZT5yf4R7Qk-aqu0LdNSRE66DquN_weYh80iwvnu9tjX6C8hCE_-MlG0jaPRdNXBucH6UmGa9sR6rGPiRR9dd7z8LAajf2FDZr9Ka0d__jXP-XIVHap1IdarZZ2UPBN5y_M8y8usyJKswIynWR51osbOVix_Zpwr_IAAQXuWbyNZ8YTzJE-Wy3WyzLOYN22xWxV5wctVusSSZYkXtos9j1ibfWSqQKke95aCnbTOzkHqWe4VYihH-GJ0B22ql_Yo1Q_5bp3RfRQIVKGBv9LekUE">