1 // RUN: %clang_cc1 -fsyntax-only -verify %s 2 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s 3 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s 4 template<typename T> struct vector; 5 6 // C++ [temp.class.spec]p6: 7 namespace N { 8 namespace M { 9 template<typename T> struct A; 10 #if __cplusplus <= 199711L // C++03 or earlier modes 11 // expected-note@-2{{explicitly specialized declaration is here}} 12 #endif 13 } 14 } 15 16 template<typename T> 17 struct N::M::A<T*> { }; 18 #if __cplusplus <= 199711L 19 // expected-warning@-2{{first declaration of class template partial specialization of 'A' outside namespace 'M' is a C++11 extension}} 20 #endif 21 22 // C++ [temp.class.spec]p9 23 // bullet 1 24 template <int I, int J> struct A {}; 25 template <int I> struct A<I+5, I*2> {}; // expected-error{{depends on}} 26 template <int I, int J> struct B {}; 27 template <int I> struct B<I, I> {}; //OK 28 29 // bullet 2 30 template <class T, T t> struct C {}; // expected-note{{declared here}} 31 template <class T> struct C<T, 1>; // expected-error{{specializes}} 32 template <class T, T* t> struct C<T*, t>; // okay 33 34 template< int X, int (*array_ptr)[X] > class A2 {}; // expected-note{{here}} 35 int array[5]; 36 template< int X > class A2<X, &array> { }; // expected-error{{specializes}} 37 38 template<typename T, int N, template<typename X> class TT> 39 struct Test0; 40 41 // bullet 3 42 template<typename T, int N, template<typename X> class TT> 43 struct Test0<T, N, TT>; // expected-error{{does not specialize}} 44 45 // C++ [temp.class.spec]p10 46 template<typename T = int, // expected-error{{default template argument}} 47 int N = 17, // expected-error{{default template argument}} 48 template<typename X> class TT = ::vector> // expected-error{{default template argument}} 49 struct Test0<T*, N, TT> { }; 50 51 template<typename T> struct Test1; 52 template<typename T, typename U> // expected-note{{non-deducible}} 53 struct Test1<T*> { }; // expected-warning{{never be used}} 54