<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/57487>57487</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Invalid type in requirement-parameter-list gives a hard error outside a concept definition
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
jwakely
</td>
</tr>
</table>
<pre>
This works OK:
```c++
template<typename T>
concept is_referenceable = requires (T&) { true; };
static_assert( ! is_referenceable<void> );
static_assert( is_referenceable<int> );
```
But this doesn't:
```c++
template<bool B> struct bool_constant
{ static constexpr bool value = B; };
template<typename T>
using is_referenceable
= bool_constant<requires (T&) { true; }>; // ???
static_assert( ! is_referenceable<void>::value );
static_assert( is_referenceable<int>::value );
```
Clang gives:
```
ref.C:4:51: error: cannot form a reference to 'void'
using is_referenceable = bool_constant<requires (T&) { true; }>;
^
ref.C:6:18: note: in instantiation of template type alias 'is_referenceable' requested here
static_assert( ! is_referenceable<void>::value );
^
1 error generated.
```
AFAICT [expr.prim.req.general] p6 doesn't treat the _requirement-parameter-list_ any differently from the _requirement-body_, so both should be valid.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJytVE1zmzAQ_TXishMGhA3mwMEf8Uymh1589whYGyUyopJw6n_fRThOWseZJi0jkMSyq7fv7VLq-lRsGmnhWZsnC9-_sWTOohWLXp5pNI6K8cUw_FuHh04JhyxZulOHrTggbFhyP1or3VbYOZB2a3CHBmkrSoXAkhUY_NFLgxYYn20YTxnPgWULcKancAtar2h6C8E64WS1FdaiceRFnvFVbEJy1LImDGTOLxGufN_xk6370-2S9Vsci96BG6iqNdqW8cx9lqtSawWL4TBL6VYOhhdbootgEogxCHExogZvwJ-d8d_BUah-5HDxPlEfq9Jb2e6v8_c2AB_3dzjJ8q-0uvcrvqZBQdbn8XX9BlKT-TnZL0l5K8K7qi6VIFr28oj2lpzjls4Kl_TJhO5pTA9AY7QZFpVoW-1gp80BBFxAgdN0fubz4tlHKvwb-xcNP3mx6f3vqaV0x7MhI0oHh1m2NDwgSezrFvQOXsoMhiIDoaQYIGZXcvDMNztSDdfQkOG_lsPtbOJRGNhji4Zw1uEH8s_X84flhpwXQ6OFnZGHkFCHo7Ni0xV06WvHE_koht8AwvaszwFbd9cJQ93m0Nwpad0WRHuCWu58Rk6dYGf04dqrpL_vlvElWE3quwZso3tVQ4lDs8sLcP8MsIjTNM6zaT7lQV0kdZ7kInDSKSweWu8wSkKi3cY2ljqVaSNMfWZK987KmrSEl193jTvZykHxoDeqaJzrfHv4Nt9L1_RlWOkDbZQ6vkx3ndGPWJGoa2ktCU-LaTaZZUFTYJbycpbkSSnSqqrzSkQT5FE82yUo0lQESpSobEFCMM5bfAYfgtYkQSALHnEezZI4zqd5zEPBd9OSQsaTLMkmUc0mER6EVOGAI9RmH5jCQyr7vSXjkLl9NVLxyX2L6I-j-KJ3jTbF47N4QnUK_NGFh_4Lk8gnMg">