Daniel Dunbar | d7d5f02 | 2009-03-24 02:24:46 +0000 | [diff] [blame] | 1 | // RUN: clang-cc -fsyntax-only -verify %s |
Douglas Gregor | 62cb18d | 2009-02-11 18:16:40 +0000 | [diff] [blame] | 2 | |
| 3 | template<typename T, int N = 2> struct X; // expected-note{{template is declared here}} |
| 4 | |
| 5 | X<int, 1> *x1; |
| 6 | X<int> *x2; |
| 7 | |
Douglas Gregor | 39a8de1 | 2009-02-25 19:37:18 +0000 | [diff] [blame] | 8 | X<> *x3; // expected-error{{too few template arguments for class template 'X'}} |
Douglas Gregor | 62cb18d | 2009-02-11 18:16:40 +0000 | [diff] [blame] | 9 | |
| 10 | template<typename U = float, int M> struct X; |
| 11 | |
| 12 | X<> *x4; |
Anders Carlsson | 9bff9a9 | 2009-06-05 02:12:32 +0000 | [diff] [blame] | 13 | |
Anders Carlsson | f4e2a2c | 2009-06-05 02:45:24 +0000 | [diff] [blame] | 14 | template<typename T = int> struct Z { }; |
Anders Carlsson | 9bff9a9 | 2009-06-05 02:12:32 +0000 | [diff] [blame] | 15 | template struct Z<>; |
Anders Carlsson | 3b56c00 | 2009-06-11 16:06:49 +0000 | [diff] [blame] | 16 | |
| 17 | // PR4362 |
| 18 | template<class T> struct a { }; |
| 19 | template<> struct a<int> { static const bool v = true; }; |
| 20 | |
| 21 | template<class T, bool = a<T>::v> struct p { }; // expected-error {{no member named 'v'}} |
| 22 | |
| 23 | template struct p<bool>; // expected-note {{in instantiation of default argument for 'p<bool>' required here}} |
| 24 | template struct p<int>; |
Douglas Gregor | 542b548 | 2009-10-14 17:30:58 +0000 | [diff] [blame^] | 25 | |
| 26 | // PR5187 |
| 27 | template<typename T, typename U> |
| 28 | struct A; |
| 29 | |
| 30 | template<typename T, typename U = T> |
| 31 | struct A; |
| 32 | |
| 33 | template<typename T, typename U> |
| 34 | struct A { |
| 35 | void f(A<T>); |
| 36 | }; |
| 37 | |
| 38 | template<typename T> |
| 39 | struct B { }; |
| 40 | |
| 41 | template<> |
| 42 | struct B<void> { |
| 43 | typedef B<void*> type; |
| 44 | }; |