https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95610
Bug ID: 95610
Summary: GCC fails to get global variable via "::" in class
specifier
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
class s;
class ::s { } ss;
$g++ -c test.cc
test.cc:2:11: error: global qualification of class name is invalid before ‘{’
token
2 | class ::s {int a;} ss;
|
GCC fails to compile this c++ code, replacing "class" with "struct" or "union"
also reproduces above result.
Also, if test.cc removes "::", GCC compiles it well.
I also tested test.cc in clang, icc, or msvc, and they compile it successfully.