[Bug c++/14769] New: Block extern incorrectly resolved to file-scope internal linkage object
algrant at acm dot org
gcc-bugzilla@gcc.gnu.org
Mon Mar 29 11:59:00 GMT 2004
In the following it is clear from the example in the C++ Standard 3.5.#6 that
the block extern declaration refers to a separate object, i.e. that there is an
internal-linkage i and an external-linkage i in the same TU. As in C a block
extern that does not 'see' an internal-linkage declaration (as in this case
where hidden by the formal) gets external linkage; C 6.2.2#7 says that having
internal and external linkage for the same name is UB but no such prohibition
applies in C++. G++ incorrectly resolves the block extern to the file-scope
object (which in C++ is internal linkage) but should instead generate an
external reference for the i object that is declared in the block extern.
#include <stdio.h>
const int i = 123;
int main(int i, char **) {
{
extern int i;
printf("i = %u\n", i);
}
return 0;
}
--
Summary: Block extern incorrectly resolved to file-scope internal
linkage object
Product: gcc
Version: 3.3.2
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: algrant at acm dot org
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14769
More information about the Gcc-bugs
mailing list