diff options
-rw-r--r-- | lib/Sema/SemaTemplate.cpp | 2 | ||||
-rw-r--r-- | test/CodeGenCXX/visibility.cpp | 17 |
2 files changed, 19 insertions, 0 deletions
diff --git a/lib/Sema/SemaTemplate.cpp b/lib/Sema/SemaTemplate.cpp index 5d14d8762c..f76c75ad7f 100644 --- a/lib/Sema/SemaTemplate.cpp +++ b/lib/Sema/SemaTemplate.cpp @@ -1102,6 +1102,8 @@ Sema::CheckClassTemplate(Scope *S, unsigned TagSpec, TagUseKind TUK, if (Attr) ProcessDeclAttributeList(S, NewClass, Attr); + AddPushedVisibilityAttribute(NewClass); + if (TUK != TUK_Friend) PushOnScopeChains(NewTemplate, S); else { diff --git a/test/CodeGenCXX/visibility.cpp b/test/CodeGenCXX/visibility.cpp index 92b7f4453f..3ea232dc00 100644 --- a/test/CodeGenCXX/visibility.cpp +++ b/test/CodeGenCXX/visibility.cpp @@ -1044,3 +1044,20 @@ namespace test56 { // CHECK: declare hidden void @_ZN6test563fooIiE3barEv // CHECK-HIDDEN: declare hidden void @_ZN6test563fooIiE3barEv } + +namespace test57 { +#pragma GCC visibility push(hidden) + template <class T> + struct foo; + void bar(foo<int>*); + template <class T> + struct foo { + static void zed(); + }; + void bah() { + foo<int>::zed(); + } +#pragma GCC visibility pop + // CHECK: declare hidden void @_ZN6test573fooIiE3zedEv + // CHECK-HIDDEN: declare hidden void @_ZN6test573fooIiE3zedEv +} |