[Bug c++/19474] wrong tree for extern "C" variables

sstrasser at systemhaus-gruppe dot de gcc-bugzilla@gcc.gnu.org
Mon Jan 31 07:48:00 GMT 2005


------- Additional Comments From sstrasser at systemhaus-gruppe dot de  2005-01-31 07:48 -------
I think I was wrong, this is a bug _and_ has effects on compilation:

in example2(see above) int a is not extern "C" in the tree, AND it is C++
mangled in compiler output!

std 7.5.7 states that a once declared extern "C" function is extern "C" even if
defined without linkage specification. I can't find the same for variables, but
since this is a redeclaration that must be the true:
extern "C"{ extern int a; }
int a;
extern "C"{ int a; }

I've attached a simple test case. link it and you'll get an undefined reference
to "a".

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|minor                       |normal


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19474



More information about the Gcc-bugs mailing list