]> granicus.if.org Git - clang/commitdiff
An attribute in a explicit template installation should take precedence over
authorRafael Espindola <rafael.espindola@gmail.com>
Sun, 22 Apr 2012 15:31:59 +0000 (15:31 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Sun, 22 Apr 2012 15:31:59 +0000 (15:31 +0000)
the tempale arguments in deciding the visibility.

This agrees with gcc 4.7.

Found by trying to build chrome with component=shared_library with 155314
reverted.

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

lib/AST/Decl.cpp
test/CodeGenCXX/visibility.cpp

index 41bc4a6e201a7156e4993d12e0b37398d37375b8..870e25274551f7d06ccdbefd9a46107c00499495 100644 (file)
@@ -407,8 +407,8 @@ static LinkageInfo getLVForNamespaceScopeDecl(const NamedDecl *D,
 
         // The arguments at which the template was instantiated.
         const TemplateArgumentList &TemplateArgs = spec->getTemplateArgs();
-        LV.mergeWithMin(getLVForTemplateArgumentList(TemplateArgs,
-                                                     OnlyTemplate));
+        LV.merge(getLVForTemplateArgumentList(TemplateArgs,
+                                              OnlyTemplate));
       }
     }
 
index f309f3fc3498607199c225eabe9411ee20111bb3..4199abbc486577d6e8aa796cdbe78e62a207b2ae 100644 (file)
@@ -660,3 +660,16 @@ namespace test32 {
   // CHECK: define void @_ZN6test321A1B3bazEv
   // CHECK-HIDDEN: define void @_ZN6test321A1B3bazEv
 }
+
+namespace test33 {
+  template<typename T>
+  class foo {
+    void bar() {}
+    int a;
+  };
+  struct __attribute__((visibility("hidden"))) zed {
+  };
+  template class __attribute__((visibility("default"))) foo<zed>;
+  // CHECK: define weak_odr void @_ZN6test333fooINS_3zedEE3barEv
+  // CHECK-HIDDEN: define weak_odr void @_ZN6test333fooINS_3zedEE3barEv
+}