]> granicus.if.org Git - clang/commitdiff
Fix handling of template parameters. Found by inspection. GCC 4.7 agrees
authorRafael Espindola <rafael.espindola@gmail.com>
Sun, 22 Apr 2012 00:43:48 +0000 (00:43 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Sun, 22 Apr 2012 00:43:48 +0000 (00:43 +0000)
with this testcase.

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

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

index ade6e2bc1b9e36d09375447f18c4d61d444c84e1..41bc4a6e201a7156e4993d12e0b37398d37375b8 100644 (file)
@@ -423,9 +423,7 @@ static LinkageInfo getLVForNamespaceScopeDecl(const NamedDecl *D,
   //     - a template, unless it is a function template that has
   //       internal linkage (Clause 14);
   } else if (const TemplateDecl *temp = dyn_cast<TemplateDecl>(D)) {
-    if (!OnlyTemplate)
-      LV.merge(getLVForTemplateParameterList(temp->getTemplateParameters()));
-
+    LV.merge(getLVForTemplateParameterList(temp->getTemplateParameters()));
   //     - a namespace (7.3), unless it is declared within an unnamed
   //       namespace.
   } else if (isa<NamespaceDecl>(D) && !D->isInAnonymousNamespace()) {
index b3c61329afe07d3412e4f6825c5e4970c7f18ee8..4b31918df8b34db92ab558c6e05abb5aed48a1da 100644 (file)
@@ -5,6 +5,20 @@
 #define PROTECTED __attribute__((visibility("protected")))
 #define DEFAULT __attribute__((visibility("default")))
 
+namespace test30 {
+  // When H is hidden, it should make X hidden, even if the template argument
+  // is not.
+  struct H {
+  };
+  template<H *T>
+  struct X {
+  };
+  H DEFAULT a;
+  X<&a> b;
+  // CHECK: _ZN6test301bE = global
+  // CHECK-HIDDEN: _ZN6test301bE = hidden global
+}
+
 namespace test25 {
   template<typename T>
   struct X {