<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/95936>95936</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Clang incorrectly accepts GCC statement-expression in template-argument lists
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
Alcaro
</td>
</tr>
</table>
<pre>
https://github.com/llvm/llvm-project/labels/extension%3Agnu https://github.com/llvm/llvm-project/labels/accepts-invalid https://github.com/llvm/llvm-project/labels/clang%3Afrontend, I think
```c++
template<bool b>
void square() {}
void cube()
{
square<({ 2+2==4; })>();
}
```
Clang instantiates square<true>(), but GCC says `<source>:6:12: error: statement-expressions are not allowed outside functions nor in template-argument lists`. https://godbolt.org/z/nbKr1soen
This is a GCC extension, so if they say it's not valid, then it isn't. (Unless Clang wants to have extensions to GCC extensions, but if so, it should probably have a -pedantic warning or something.)
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyklMGu8jYThq_G2YxAyZgQssgCws-vqtv2ApxkSNwam3omnI9efeUEdE4_VZXaShbE9uixZ-Z9bZjt6IkaVZ5Uec7MLFOIzdH1JoasC8OzmUTurPRR4UXhZbQyzd22DzeFF-ce77_NPYZfqJc0NR05Vnihb0KebfAKS30c_Qz_nmX6nu7CG-sfxtnhP5B6Z_y43Ogagxfyg8IWfgCZrP9V5WeVH1-_-3wdvcJTGsuq0O3ujJDSbReCg07p_607j2AH4N9mE0nhQWENqjqp6vyVucT0c_eKeG1VLzYAvAG6TRHVCVDhCZU-K33eKX2CBMQ6HboS9OkNOX937XXapnTBehbjxRoh_jxC4kyfJGyhmwX-37bA5smQELrlMMd-idLHvdLHApU-AsUYYvpgMUI38rKhb_dInNrNYCKBDwLGufBBA4RZ2A4E19n3skT4EMF6eFdzY-I4Jww4y8Jqn2-_b3EYuuBkG-Ko8PK7wovvfowFB_JfC_zTZBksg1ny-KLAFjiAvYJM9Ez5gRWFFS_XXCSVQmQiD1bAsldYyRYUHn72jphhreOH8cIgASbzoE_8svSnA_ldTnsFDmliBXgKsxvgHkNnOvdcIQY2dxpSc3r4MNFbP0KIwOFGSZLjVmGdDY0eal2bjJqiKg4VFpXGbGpKNKbb911XUl3udthVPV67vNRlaQ4FFpltMMddvi8OxW6HBW6veZ1TjkO-L4r6WqLa5XQz1m2TX1J1M8s8U1OXtd5nq2uW1wHx5RxMD0VsFn9188hqly9N-ySIFUfNW3l9iJF6cU94mXiV2F8I528Ukc3R_fOnaEklmX7N5tHgHwEAAP__cDeRRg">