]> granicus.if.org Git - clang/commitdiff
Handle static functions being redeclared in function scope.
authorRafael Espindola <rafael.espindola@gmail.com>
Wed, 9 Jan 2013 16:34:58 +0000 (16:34 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Wed, 9 Jan 2013 16:34:58 +0000 (16:34 +0000)
Fixes pr14861.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171978 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/Decl.cpp
test/SemaCXX/linkage2.cpp

index 35e61b57754aa198b88b86125dfb9f7310f9ba1c..bf5bfaaef10b3df043523c7f86ed594b9762a930 100644 (file)
@@ -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())
index bab163db2ab4455a8970bf72d494e7b1cec4f1c4..072dcd2413d09ad0a4b352efae921b0d38c98196 100644 (file)
@@ -40,3 +40,11 @@ namespace test4 {
     };
   }
 }
+
+namespace test5 {
+  static void g();
+  void f()
+  {
+    void g();
+  }
+}