blob: 33677aab73acb0c418c6aaa9ddf774a9ab70670a [file] [log] [blame]
Daniel Dunbard7d5f022009-03-24 02:24:46 +00001// RUN: clang-cc -fsyntax-only -verify %s
Douglas Gregor62cb18d2009-02-11 18:16:40 +00002
3template<typename T, int N = 2> struct X; // expected-note{{template is declared here}}
4
5X<int, 1> *x1;
6X<int> *x2;
7
Douglas Gregor39a8de12009-02-25 19:37:18 +00008X<> *x3; // expected-error{{too few template arguments for class template 'X'}}
Douglas Gregor62cb18d2009-02-11 18:16:40 +00009
10template<typename U = float, int M> struct X;
11
12X<> *x4;
Anders Carlsson9bff9a92009-06-05 02:12:32 +000013
Anders Carlssonf4e2a2c2009-06-05 02:45:24 +000014template<typename T = int> struct Z { };
Anders Carlsson9bff9a92009-06-05 02:12:32 +000015template struct Z<>;
Anders Carlsson3b56c002009-06-11 16:06:49 +000016
17// PR4362
18template<class T> struct a { };
19template<> struct a<int> { static const bool v = true; };
20
21template<class T, bool = a<T>::v> struct p { }; // expected-error {{no member named 'v'}}
22
23template struct p<bool>; // expected-note {{in instantiation of default argument for 'p<bool>' required here}}
24template struct p<int>;
Douglas Gregor542b5482009-10-14 17:30:58 +000025
26// PR5187
27template<typename T, typename U>
28struct A;
29
30template<typename T, typename U = T>
31struct A;
32
33template<typename T, typename U>
34struct A {
35 void f(A<T>);
36};
37
38template<typename T>
39struct B { };
40
41template<>
42struct B<void> {
43 typedef B<void*> type;
44};