From: Rafael Espindola Date: Mon, 23 Apr 2012 17:51:55 +0000 (+0000) Subject: Fix visibility when we have two types with explicit visibility in a template X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=923b0c93375db7e75a02bceb487f6f3d3da2766f;p=clang Fix visibility when we have two types with explicit visibility in a template argument list. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155368 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp index 77cc7a29b4..a98e8dddbb 100644 --- a/lib/AST/Decl.cpp +++ b/lib/AST/Decl.cpp @@ -122,7 +122,7 @@ static LinkageInfo getLVForTemplateArgumentList(const TemplateArgument *Args, break; case TemplateArgument::Type: - LV.merge(getLVForType(Args[I].getAsType())); + LV.mergeWithMin(getLVForType(Args[I].getAsType())); break; case TemplateArgument::Declaration: @@ -130,7 +130,7 @@ static LinkageInfo getLVForTemplateArgumentList(const TemplateArgument *Args, // arguments, valid only in C++0x. if (Decl *D = Args[I].getAsDecl()) { if (NamedDecl *ND = dyn_cast(D)) - LV.merge(getLVForDecl(ND, OnlyTemplate)); + LV.mergeWithMin(getLVForDecl(ND, OnlyTemplate)); } break; @@ -138,7 +138,7 @@ static LinkageInfo getLVForTemplateArgumentList(const TemplateArgument *Args, case TemplateArgument::TemplateExpansion: if (TemplateDecl *Template = Args[I].getAsTemplateOrTemplatePattern().getAsTemplateDecl()) - LV.merge(getLVForDecl(Template, OnlyTemplate)); + LV.mergeWithMin(getLVForDecl(Template, OnlyTemplate)); break; case TemplateArgument::Pack: diff --git a/test/CodeGenCXX/visibility.cpp b/test/CodeGenCXX/visibility.cpp index d126de3d05..2aa067886a 100644 --- a/test/CodeGenCXX/visibility.cpp +++ b/test/CodeGenCXX/visibility.cpp @@ -700,3 +700,15 @@ namespace test35 { // CHECK: define weak_odr void @_ZN6test353fooINS_3zedEE3barEv // CHECK-HIDDEN: define weak_odr void @_ZN6test353fooINS_3zedEE3barEv } + +namespace test36 { + template + class foo { + void bar() {} + }; + class DEFAULT S1 {}; + struct HIDDEN S2 {}; + template class foo; + // CHECK: define weak_odr hidden void @_ZN6test363fooINS_2S1ENS_2S2EE3barEv + // CHECK-HIDDEN: define weak_odr hidden void @_ZN6test363fooINS_2S1ENS_2S2EE3barEv +}