const unsigned abc = 5;
$ g++ -c -o ec.o ec.cpp
$ nm ec.o
0000000000000000 r _ZL3abc
So far so good: abc has C++ mangling.
Now:
extern const unsigned abc;
const unsigned abc = 5;
$ g++ -c -o ec.o ec.cpp
$ nm ec.o
0000000000000000 R abc
Mangling changed to C... Then:
extern "C++" const unsigned abc;
const unsigned abc = 5;
$ g++ -c -o ec.o ec.cpp
$ nm ec.o
0000000000000000 R abc
Mangling is still C, even though I explicitly asked for C++ one. Why that happens?