https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86181
--- Comment #2 from zhonghao at pku dot org.cn --- I reported the code to llvm. A developer of llvm said: Clang follows the agreed direction for CWG issue 1839, which says that redeclaration lookup for 'extern int i;' finds the 'static int i;' declared at namespace scope and thus the internal linkage is inherited. Does gcc follow a different lookup?