From 0b0620776aad13d3668994a2a71f6a588283cca4 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Tue, 3 Jan 2012 06:04:21 +0000 Subject: [PATCH] Process attributes in explicit template instatiation definitions. Fixes PR11690. llvm-svn: 147441 --- clang/lib/Sema/SemaTemplate.cpp | 3 +++ clang/test/CodeGenCXX/visibility.cpp | 10 ++++++++++ 2 files changed, 13 insertions(+) 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 +}