]> granicus.if.org Git - clang/commitdiff
More tests for explicit template specialization
authorDouglas Gregor <dgregor@apple.com>
Mon, 12 Oct 2009 20:45:50 +0000 (20:45 +0000)
committerDouglas Gregor <dgregor@apple.com>
Mon, 12 Oct 2009 20:45:50 +0000 (20:45 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83896 91177308-0d34-0410-b5e6-96231b3b80d8

test/CXX/temp/temp.spec/temp.expl.spec/p10.cpp [new file with mode: 0644]
test/CXX/temp/temp.spec/temp.expl.spec/p11.cpp [new file with mode: 0644]
test/CXX/temp/temp.spec/temp.expl.spec/p13.cpp [new file with mode: 0644]
test/CXX/temp/temp.spec/temp.expl.spec/p9.cpp [new file with mode: 0644]

diff --git a/test/CXX/temp/temp.spec/temp.expl.spec/p10.cpp b/test/CXX/temp/temp.spec/temp.expl.spec/p10.cpp
new file mode 100644 (file)
index 0000000..61f1710
--- /dev/null
@@ -0,0 +1,7 @@
+// RUN: clang-cc -fsyntax-only -verify %s
+
+template<class T> class X; 
+template<> class X<int>; // expected-note{{forward}}
+X<int>* p; 
+
+X<int> x; // expected-error{{incomplete type}}
diff --git a/test/CXX/temp/temp.spec/temp.expl.spec/p11.cpp b/test/CXX/temp/temp.spec/temp.expl.spec/p11.cpp
new file mode 100644 (file)
index 0000000..e794e67
--- /dev/null
@@ -0,0 +1,8 @@
+// RUN: clang-cc -fsyntax-only -verify %s
+
+template<class T> class Array { /* ... */ }; 
+template<class T> void sort(Array<T>& v);
+
+// explicit specialization for sort(Array<int>&) 
+// with deduced template-argument of type int 
+template<> void sort(Array<int>&);
diff --git a/test/CXX/temp/temp.spec/temp.expl.spec/p13.cpp b/test/CXX/temp/temp.spec/temp.expl.spec/p13.cpp
new file mode 100644 (file)
index 0000000..63cf9f5
--- /dev/null
@@ -0,0 +1,6 @@
+// RUN: clang-cc -fsyntax-only %s
+
+template<typename T> void f(T);
+
+template<> void f(int) { }
+void f(int) { }
diff --git a/test/CXX/temp/temp.spec/temp.expl.spec/p9.cpp b/test/CXX/temp/temp.spec/temp.expl.spec/p9.cpp
new file mode 100644 (file)
index 0000000..49481d2
--- /dev/null
@@ -0,0 +1,14 @@
+// RUN: clang-cc -fsyntax-only -verify %s
+
+namespace N { 
+  template<class T> class X { /* ... */ }; 
+  template<class T> class Y { /* ... */ };
+  template<> class X<int> { /* ... */ }; 
+  template<> class Y<double>;
+  
+  const unsigned NumElements = 17;
+} 
+
+template<> class N::Y<double> { 
+  int array[NumElements];
+};