https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91464
Bug ID: 91464
Summary: C++ extern "C" namespace A {int value;}; is definition
not declaration
Product: gcc
Version: 9.2.1
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: dje at gcc dot gnu.org
CC: jakub at gcc dot gnu.org, jason at gcc dot gnu.org
Target Milestone: ---
From Twitter
extern "C" namespace A
{
int value;
}
int getValue ()
{
return A::value;
}
Clang compiles correctly this first scenario:
https://godbolt.org/z/FjUGov
while GCC doesn't compile:
https://godbolt.org/z/Ohfsgi
Clang compiles correctly this 2nd scenario:
https://godbolt.org/z/LhzeOo
while GCC compiles it wrongly:
https://godbolt.org/z/Nsiy5_