[Bug c++/95559] GCC fails to compile "{{}}" in some versions
haoxintu at gmail dot com
gcc-bugzilla@gcc.gnu.org
Tue Jun 9 23:36:21 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95559
--- Comment #2 from Haoxin Tu <haoxintu at gmail dot com> ---
(In reply to Marek Polacek from comment #1)
> I can't find a version of GCC that compiled this.
Hi, so sorry I might use the wrong test case. Please try this case bug.cc
instead
#include <iostream>
int main(){
int a = {{}};
std::cout << a << std::endl;
return 0;
}
In godbolt https://godbolt.org/z/K_drKC .
Also, in my machine,
$g++-8 test.cc ; ./a.out
0
$g++-8 --version
g++-8 (Ubuntu 8.4.0-1ubuntu1~18.04) 8.4.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$g++-trunk bug.cc
bug.cc: In function ‘int main()’:
bug.cc:3:16: error: too many braces around scalar initializer for type ‘int’
3 | int a = {{}};
|
$g++-trunk --version
g++ (GCC) 11.0.0 20200526 (experimental)
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
> I don't think this is rejects-valid.
I guess clang might have some issue in compiling "{{}}", clang accepts this
code but icc or msvc reject.
Please take a look at above situation, thanks ~
More information about the Gcc-bugs
mailing list