| 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 | } |
| 11 | } |
| 12 | |
| 13 | template<typename T> |
| 14 | struct N::M::A<T*> { }; |
| 15 | |
| 16 | // C++ [temp.class.spec]p9 |
| 17 | // bullet 1, as amended by DR1315 |
| 18 | template <int I, int J> struct A {}; |
| 19 | template <int I> struct A<I+5, I*2> {}; // expected-error{{cannot be deduced}} expected-note {{'I'}} |
| 20 | template <int I, int J> struct B {}; |
| 21 | template <int I> struct B<I, I> {}; //OK |
| 22 | |
| 23 | // bullet 2 |
| 24 | template <class T, T t> struct C {}; // expected-note{{declared here}} |
| 25 | template <class T> struct C<T, 1>; // expected-error{{specializes}} |
| 26 | template <class T, T* t> struct C<T*, t>; // okay |
| 27 | |
| 28 | template< int X, int (*array_ptr)[X] > class A2 {}; // expected-note{{here}} |
| 29 | int array[5]; |
| 30 | template< int X > class A2<X, &array> { }; // expected-error{{specializes}} |
| 31 | |
| 32 | template<typename T, int N, template<typename X> class TT> |
| 33 | struct Test0; |
| 34 | |
| 35 | // bullet 3 |
| 36 | template<typename T, int N, template<typename X> class TT> |
| 37 | struct Test0<T, N, TT>; // expected-error{{does not specialize}} |
| 38 | |
| 39 | // C++ [temp.class.spec]p10 |
| 40 | template<typename T = int, // expected-error{{default template argument}} |
| 41 | int N = 17, // expected-error{{default template argument}} |
| 42 | template<typename X> class TT = ::vector> // expected-error{{default template argument}} |
| 43 | struct Test0<T*, N, TT> { }; |
| 44 | |
| 45 | template<typename T> struct Test1; |
| 46 | template<typename T, typename U> // expected-note{{non-deducible}} |
| 47 | struct Test1<T*> { }; // expected-error{{never be used}} |
| 48 | |