Issue 95936
Summary Clang incorrectly accepts GCC statement-_expression_ in template-argument lists
Labels clang
Assignees
Reporter Alcaro
    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.)
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to