More tests for explicit template specialization

llvm-svn: 83896
This commit is contained in:
Douglas Gregor 2009-10-12 20:45:50 +00:00
parent bf43817408
commit 1fc79dda69
4 changed files with 35 additions and 0 deletions

View File

@ -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}}

View File

@ -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>&);

View File

@ -0,0 +1,6 @@
// RUN: clang-cc -fsyntax-only %s
template<typename T> void f(T);
template<> void f(int) { }
void f(int) { }

View File

@ -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];
};