blob: db6759814b9b6bc9b9973df91bcdaaf0217c0fba [file] [log] [blame]
Douglas Gregora08b6c72009-02-17 23:15:12 +00001// RUN: clang -fsyntax-only -verify %s
2template<typename T, typename U = int> class A;
3
4template<> class A<double, double>; // expected-note{{forward declaration}}
5
6template<> class A<float, float> { // expected-note{{previous definition}}
7 int x;
8};
9
10template<> class A<float> { // expected-note{{previous definition}}
11 int y;
12};
13
14int test_specs(A<float, float> *a1, A<float, int> *a2) {
15 return a1->x + a2->y;
16}
17
18int test_incomplete_specs(A<double, double> *a1,
19 A<double> *a2) // FIXME: expected-note{{forward declaration}}
20{
21 (void)a1->x; // expected-error{{incomplete definition of type 'A<double, double>'}}
22 (void)a2->x; // expected-error{{incomplete definition of type 'A<double>'}}
23}
24
25typedef float FLOAT;
26
27template<> class A<float, FLOAT>;
28
29template<> class A<FLOAT, float> { }; // expected-error{{redefinition}}
30
31template<> class A<float, int> { }; // expected-error{{redefinition}}