https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91075

--- Comment #1 from joseph at codesourcery dot com <joseph at codesourcery dot 
com> ---
This would definitely be invalid C (the prior declaration visible in the 
inner scope has no linkage, so the inner declaration has external linkage 
and "If, within a translation unit, the same identifier appears with both 
internal and external linkage, the behavior is undefined." applies).

For C++, it appears the example in 3.5 paragraph 6 in the (old) document 
you linked to is the relevant one, explicitly saying the inner declaration 
refers to an entity with external linkage which is different from the 
static variable with internal linkage.  In C++17, [basic.link] paragraph 6 
says this example is ill-formed; no doubt one of our C++ experts can give 
details of when and why this changed and whether it was a defect fix.

Reply via email to