summaryrefslogtreecommitdiffstats
path: root/test/CodeGenCXX/visibility-hidden-extern-templates.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-06-21 18:41:26 +0000
committerDouglas Gregor <dgregor@apple.com>2010-06-21 18:41:26 +0000
commitaf896897f7485176f43d40c4adced7efb0fb2b06 (patch)
tree2b4d25c1b824f8bbf4c28a604eb55bcea6e926ea /test/CodeGenCXX/visibility-hidden-extern-templates.cpp
parent2bf6d7b1f7406ca4dfe841d4f6ef4b91dce195e4 (diff)
Instantiations subject to an explicit template instantiation
declaration have default visibility even under -fvisibility=hidden. Fixes <rdar://problem/8109763>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106440 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/visibility-hidden-extern-templates.cpp')
-rw-r--r--test/CodeGenCXX/visibility-hidden-extern-templates.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/CodeGenCXX/visibility-hidden-extern-templates.cpp b/test/CodeGenCXX/visibility-hidden-extern-templates.cpp
new file mode 100644
index 0000000000..4c133ec32c
--- /dev/null
+++ b/test/CodeGenCXX/visibility-hidden-extern-templates.cpp
@@ -0,0 +1,26 @@
+// RUN: %clang_cc1 -emit-llvm -o - -fvisibility hidden %s | FileCheck %s
+
+template<typename T>
+struct X {
+ void f();
+ void g() { }
+};
+
+template<typename T> void X<T>::f() { }
+
+extern template struct X<int>;
+template struct X<int>;
+extern template struct X<char>;
+
+// <rdar://problem/8109763>
+void test_X(X<int> xi, X<char> xc) {
+ // CHECK: define weak_odr hidden void @_ZN1XIiE1fEv
+ xi.f();
+ // CHECK: define weak_odr hidden void @_ZN1XIiE1gEv
+ xi.g();
+ // CHECK: declare void @_ZN1XIcE1fEv
+ xc.f();
+ // CHECK: define available_externally void @_ZN1XIcE1gEv
+ xc.g();
+}
+