diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp index b0006e6ac2a3..e90821e451fb 100644 --- a/clang/lib/Sema/SemaTemplate.cpp +++ b/clang/lib/Sema/SemaTemplate.cpp @@ -5988,6 +5988,9 @@ Sema::ActOnExplicitInstantiation(Scope *S, Specialization->setExternLoc(ExternLoc); Specialization->setTemplateKeywordLoc(TemplateLoc); + if (Attr) + ProcessDeclAttributeList(S, Specialization, Attr); + // Add the explicit instantiation into its lexical context. However, // since explicit instantiations are never found by name lookup, we // just put it into the declaration context directly. diff --git a/clang/test/CodeGenCXX/visibility.cpp b/clang/test/CodeGenCXX/visibility.cpp index cfa4f4fbcf21..54dacac99950 100644 --- a/clang/test/CodeGenCXX/visibility.cpp +++ b/clang/test/CodeGenCXX/visibility.cpp @@ -466,3 +466,13 @@ namespace PR10113 { // CHECK: define weak_odr void @_ZN7PR101133foo3barIcE3zedEv // CHECK-HIDDEN: define weak_odr void @_ZN7PR101133foo3barIcE3zedEv } + +namespace PR11690 { + template struct Class { + void size() const { + } + }; + template class DEFAULT Class; + // CHECK: define weak_odr void @_ZNK7PR116905ClassIcE4sizeEv + // CHECK-HIDDEN: define weak_odr void @_ZNK7PR116905ClassIcE4sizeEv +}