Douglas Gregor | ba1ecb5 | 2009-06-12 19:43:02 +0000 | [diff] [blame] | 1 | // RUN: clang-cc -fsyntax-only -verify %s |
| 2 | |
| 3 | template<typename T> struct vector; |
| 4 | |
Douglas Gregor | e94866f | 2009-06-12 21:21:02 +0000 | [diff] [blame^] | 5 | // C++ [temp.class.spec]p9 |
| 6 | |
| 7 | // bullet 1 |
| 8 | template <int I, int J> struct A {}; |
| 9 | template <int I> struct A<I+5, I*2> {}; // expected-error{{depends on}} |
| 10 | template <int I, int J> struct B {}; |
| 11 | template <int I> struct B<I, I> {}; //OK |
| 12 | |
| 13 | // bullet 2 |
| 14 | template <class T, T t> struct C {}; // expected-note{{declared here}} |
| 15 | template <class T> struct C<T, 1>; // expected-error{{specializes}} |
| 16 | template <class T, T* t> struct C<T*, t>; // okay |
| 17 | |
| 18 | template< int X, int (*array_ptr)[X] > class A2 {}; // expected-note{{here}} |
| 19 | int array[5]; |
| 20 | template< int X > class A2<X,&array> { }; // expected-error{{specializes}} |
| 21 | |
| 22 | // C++ [temp.class.spec]p10 |
Douglas Gregor | ba1ecb5 | 2009-06-12 19:43:02 +0000 | [diff] [blame] | 23 | template<typename T, int N, template<typename X> class TT> |
| 24 | struct Test0; |
| 25 | |
| 26 | template<typename T = int, // expected-error{{default template argument}} |
| 27 | int N = 17, // expected-error{{default template argument}} |
| 28 | template<typename X> class TT = ::vector> // expected-error{{default template argument}} |
| 29 | struct Test0<T*, N, TT> { }; |