diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2012-04-22 00:43:48 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2012-04-22 00:43:48 +0000 |
commit | 60115a0453ecfbfe215fdb10aceab983e5f802ef (patch) | |
tree | 9e508d17c0e3f272ccc7f25d44a0a511dd7605ca | |
parent | 1266b613e48bb9fc8155b3ac486a6ac06a75291f (diff) |
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
-rw-r--r-- | lib/AST/Decl.cpp | 4 | ||||
-rw-r--r-- | test/CodeGenCXX/visibility.cpp | 14 |
2 files changed, 15 insertions, 3 deletions
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<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()) { 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<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 { |