aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-10-12 21:21:22 +0000
committerDouglas Gregor <dgregor@apple.com>2009-10-12 21:21:22 +0000
commit27c8235def85fc7f92fcaffe7907eef0552ca209 (patch)
tree88316c74a934ac316baf3463279e6556d5ecd6f9
parent5017a157c6c5462ea1d4154d7d758ee3d277b735 (diff)
Yet another test for explicit specialization, this one involving linkage
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83901 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--test/CXX/temp/temp.spec/temp.expl.spec/p14.cpp42
1 files changed, 42 insertions, 0 deletions
diff --git a/test/CXX/temp/temp.spec/temp.expl.spec/p14.cpp b/test/CXX/temp/temp.spec/temp.expl.spec/p14.cpp
new file mode 100644
index 0000000000..a5d5b9e3c4
--- /dev/null
+++ b/test/CXX/temp/temp.spec/temp.expl.spec/p14.cpp
@@ -0,0 +1,42 @@
+// RUN: clang-cc -emit-llvm -o - %s | FileCheck %s
+
+template<class T> void f(T) { /* ... */ }
+template<class T> inline void g(T) { /* ... */ }
+
+// CHECK: define void @_Z1gIiEvT_
+template<> void g<>(int) { /* ... */ }
+
+template<class T>
+struct X {
+ void f() { }
+ void g();
+ void h();
+};
+
+template<class T>
+void X<T>::g() {
+}
+
+template<class T>
+inline void X<T>::h() {
+}
+
+// CHECK: define void @_ZN1XIiE1fEv
+template<> void X<int>::f() { }
+
+// CHECK: define void @_ZN1XIiE1hEv
+template<> void X<int>::h() { }
+
+// CHECK: define linkonce_odr void @_Z1fIiEvT_
+template<> inline void f<>(int) { /* ... */ }
+
+// CHECK: define linkonce_odr void @_ZN1XIiE1gEv
+template<> inline void X<int>::g() { }
+
+void test(X<int> xi) {
+ f(17);
+ g(17);
+ xi.f();
+ xi.g();
+ xi.h();
+}