[Bug c++/95559] New: Compiling "{{}}" result is inconsistent in different versions
haoxintu at gmail dot com
gcc-bugzilla@gcc.gnu.org
Sat Jun 6 04:11:43 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95559
Bug ID: 95559
Summary: Compiling "{{}}" result is inconsistent in different
versions
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: haoxintu at gmail dot com
Target Milestone: ---
This case test.cc
#include<iostream>
int main() {
return {{}};
}
In the version of GCC 6.1 - 8.4, it's compiled ok.
But in GCC 6.1 lower and 8.4 higher version, for example, in GCC trunk
$g++-trunk test.cc
test.cc: In function 'int main()':
test.cc:3:15: error: too many braces around scalar initializer for type 'int'
3 | int var = {{}};
|
I also compiled test.cc in recent released Clang, and they all accept "{{}}".
Should GCC compile "{{}}" fine also? I think this is a supported feature
according to https://en.cppreference.com/w/cpp/language/return.
More information about the Gcc-bugs
mailing list