diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2013-01-09 16:34:58 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2013-01-09 16:34:58 +0000 |
commit | abe75ef905626d00358427a7a3c59480c1f03361 (patch) | |
tree | e886933b38bb8a7fced293608bb8afc261f44ca0 | |
parent | 526ed11ad9743c773df76bd1649d33fb92c2b8cb (diff) |
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
-rw-r--r-- | lib/AST/Decl.cpp | 4 | ||||
-rw-r--r-- | test/SemaCXX/linkage2.cpp | 8 |
2 files changed, 12 insertions, 0 deletions
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<Visibility> 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(); + } +} |