Douglas Gregor | a08b6c7 | 2009-02-17 23:15:12 +0000 | [diff] [blame^] | 1 | // RUN: clang -fsyntax-only -verify %s |
| 2 | template<typename T, typename U = int> class A; |
| 3 | |
| 4 | template<> class A<double, double>; // expected-note{{forward declaration}} |
| 5 | |
| 6 | template<> class A<float, float> { // expected-note{{previous definition}} |
| 7 | int x; |
| 8 | }; |
| 9 | |
| 10 | template<> class A<float> { // expected-note{{previous definition}} |
| 11 | int y; |
| 12 | }; |
| 13 | |
| 14 | int test_specs(A<float, float> *a1, A<float, int> *a2) { |
| 15 | return a1->x + a2->y; |
| 16 | } |
| 17 | |
| 18 | int 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 | |
| 25 | typedef float FLOAT; |
| 26 | |
| 27 | template<> class A<float, FLOAT>; |
| 28 | |
| 29 | template<> class A<FLOAT, float> { }; // expected-error{{redefinition}} |
| 30 | |
| 31 | template<> class A<float, int> { }; // expected-error{{redefinition}} |