extern int foo[]; // OK int foo[]={1,2,3}; extern int foo[]; // OK void bar(){ extern int foo[]; // g++: ERROR -- SHOULD BE OK }
g++ 3.4.0, 3.4.3, 4.0.0 (cygwin), g++ 3.4.2 (mingw): xxx.cpp: In function 'void bar()': xxx.cpp:6: error: type mismatch with previous external decl of 'int foo []' xxx.cpp:2: error: previous external decl of 'int foo [3]' g++ 3.3.1, 3.3.2 (cygwin) issue a slightly different error message This may be related to PRs 21342 and 21502. Vladimir Marko -- Summary: extern array: compatible declaration at function scope refused Product: gcc Version: 4.0.0 Status: UNCONFIRMED Severity: normal Priority: P2 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: SWElef at post dot sk CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22556