diff options
-rw-r--r-- | lib/AST/Decl.cpp | 20 | ||||
-rw-r--r-- | test/CodeGenCXX/visibility.cpp | 17 |
2 files changed, 31 insertions, 6 deletions
diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp index 979971c7c3..e8d7093a3f 100644 --- a/lib/AST/Decl.cpp +++ b/lib/AST/Decl.cpp @@ -546,14 +546,22 @@ static LinkageInfo getLVForClassMember(const NamedDecl *D, bool OnlyTemplate) { } else if (const CXXRecordDecl *RD = dyn_cast<CXXRecordDecl>(D)) { if (const ClassTemplateSpecializationDecl *spec = dyn_cast<ClassTemplateSpecializationDecl>(RD)) { + // Merge template argument/parameter information for member + // class template specializations. + const TemplateArgumentList &TemplateArgs = spec->getTemplateArgs(); + LinkageInfo ArgsLV = getLVForTemplateArgumentList(TemplateArgs, + OnlyTemplate); + TemplateParameterList *TemplateParams = + spec->getSpecializedTemplate()->getTemplateParameters(); + LinkageInfo ParamsLV = getLVForTemplateParameterList(TemplateParams); if (shouldConsiderTemplateVis(spec)) { - // Merge template argument/parameter information for member - // class template specializations. - LV.mergeWithMin(getLVForTemplateArgumentList(spec->getTemplateArgs(), - OnlyTemplate)); + LV.mergeWithMin(ArgsLV); if (!OnlyTemplate) - LV.merge(getLVForTemplateParameterList( - spec->getSpecializedTemplate()->getTemplateParameters())); + LV.merge(ParamsLV); + } else { + LV.mergeLinkage(ArgsLV); + if (!OnlyTemplate) + LV.mergeLinkage(ParamsLV); } } diff --git a/test/CodeGenCXX/visibility.cpp b/test/CodeGenCXX/visibility.cpp index d889684314..17ba33dabe 100644 --- a/test/CodeGenCXX/visibility.cpp +++ b/test/CodeGenCXX/visibility.cpp @@ -832,3 +832,20 @@ namespace test44 { // CHECK: define internal void @_ZN6test443fooINS_12_GLOBAL__N_13barEEC1Ev // CHECK-HIDDEN: define internal void @_ZN6test443fooINS_12_GLOBAL__N_13barEEC1Ev } + +namespace test45 { + template <typename T> + struct foo { + template <typename T2> + struct bar { + bar() {}; + }; + }; + namespace { + struct zed; + } + template struct DEFAULT foo<int>::bar<zed>; + foo<int>::bar<zed> x; + // CHECK: define internal void @_ZN6test453fooIiE3barINS_12_GLOBAL__N_13zedEEC1Ev + // CHECK-HIDDEN: define internal void @_ZN6test453fooIiE3barINS_12_GLOBAL__N_13zedEEC1Ev +} |