Fix handling of template parameters. Found by inspection. GCC 4.7 agrees

with this testcase.

llvm-svn: 155301
This commit is contained in:
Rafael Espindola 2012-04-22 00:43:48 +00:00
parent 32854e2727
commit 8add48ec9e
2 changed files with 15 additions and 3 deletions

View 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()) {

View 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 {