From: Rafael Espindola Date: Sun, 22 Apr 2012 15:31:59 +0000 (+0000) Subject: An attribute in a explicit template installation should take precedence over X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f6a8b9cba4893b552704f64dd279b4cdc8c13f6f;p=clang An attribute in a explicit template installation should take precedence over the tempale arguments in deciding the visibility. This agrees with gcc 4.7. Found by trying to build chrome with component=shared_library with 155314 reverted. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155316 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp index 41bc4a6e20..870e252745 100644 --- a/lib/AST/Decl.cpp +++ b/lib/AST/Decl.cpp @@ -407,8 +407,8 @@ static LinkageInfo getLVForNamespaceScopeDecl(const NamedDecl *D, // The arguments at which the template was instantiated. const TemplateArgumentList &TemplateArgs = spec->getTemplateArgs(); - LV.mergeWithMin(getLVForTemplateArgumentList(TemplateArgs, - OnlyTemplate)); + LV.merge(getLVForTemplateArgumentList(TemplateArgs, + OnlyTemplate)); } } diff --git a/test/CodeGenCXX/visibility.cpp b/test/CodeGenCXX/visibility.cpp index f309f3fc34..4199abbc48 100644 --- a/test/CodeGenCXX/visibility.cpp +++ b/test/CodeGenCXX/visibility.cpp @@ -660,3 +660,16 @@ namespace test32 { // CHECK: define void @_ZN6test321A1B3bazEv // CHECK-HIDDEN: define void @_ZN6test321A1B3bazEv } + +namespace test33 { + template + class foo { + void bar() {} + int a; + }; + struct __attribute__((visibility("hidden"))) zed { + }; + template class __attribute__((visibility("default"))) foo; + // CHECK: define weak_odr void @_ZN6test333fooINS_3zedEE3barEv + // CHECK-HIDDEN: define weak_odr void @_ZN6test333fooINS_3zedEE3barEv +}