From: Rafael Espindola Date: Sun, 22 Apr 2012 00:43:48 +0000 (+0000) Subject: Fix handling of template parameters. Found by inspection. GCC 4.7 agrees X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=60115a0453ecfbfe215fdb10aceab983e5f802ef;p=clang Fix handling of template parameters. Found by inspection. GCC 4.7 agrees with this testcase. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155301 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp index ade6e2bc1b..41bc4a6e20 100644 --- a/lib/AST/Decl.cpp +++ b/lib/AST/Decl.cpp @@ -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(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(D) && !D->isInAnonymousNamespace()) { diff --git a/test/CodeGenCXX/visibility.cpp b/test/CodeGenCXX/visibility.cpp index b3c61329af..4b31918df8 100644 --- a/test/CodeGenCXX/visibility.cpp +++ b/test/CodeGenCXX/visibility.cpp @@ -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 + struct X { + }; + H DEFAULT a; + X<&a> b; + // CHECK: _ZN6test301bE = global + // CHECK-HIDDEN: _ZN6test301bE = hidden global +} + namespace test25 { template struct X {