Apply visibility pragmas to class template declarations. This is needed because
we might use the declaration to build a type before seeing the definition.

llvm-svn: 160176
diff --git a/clang/test/CodeGenCXX/visibility.cpp b/clang/test/CodeGenCXX/visibility.cpp
index 92b7f44..3ea232d 100644
--- a/clang/test/CodeGenCXX/visibility.cpp
+++ b/clang/test/CodeGenCXX/visibility.cpp
@@ -1044,3 +1044,20 @@
   // 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
+}