From: Rafael Espindola Date: Wed, 9 Jan 2013 16:34:58 +0000 (+0000) Subject: Handle static functions being redeclared in function scope. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=abe75ef905626d00358427a7a3c59480c1f03361;p=clang Handle static functions being redeclared in function scope. Fixes pr14861. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171978 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp index 35e61b5775..bf5bfaaef1 100644 --- a/lib/AST/Decl.cpp +++ b/lib/AST/Decl.cpp @@ -803,6 +803,10 @@ static LinkageInfo computeLVForDecl(const NamedDecl *D, bool OnlyTemplate) { !Function->getDeclContext()->isExternCContext()) return LinkageInfo::uniqueExternal(); + // This is a "void f();" which got merged with a file static. + if (Function->getStorageClass() == SC_Static) + return LinkageInfo::internal(); + LinkageInfo LV; if (!OnlyTemplate) { if (llvm::Optional Vis = Function->getExplicitVisibility()) diff --git a/test/SemaCXX/linkage2.cpp b/test/SemaCXX/linkage2.cpp index bab163db2a..072dcd2413 100644 --- a/test/SemaCXX/linkage2.cpp +++ b/test/SemaCXX/linkage2.cpp @@ -40,3 +40,11 @@ namespace test4 { }; } } + +namespace test5 { + static void g(); + void f() + { + void g(); + } +}