diff options
Diffstat (limited to 'clang/test/SemaTemplate/class-template-spec.cpp')
-rw-r--r-- | clang/test/SemaTemplate/class-template-spec.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/clang/test/SemaTemplate/class-template-spec.cpp b/clang/test/SemaTemplate/class-template-spec.cpp new file mode 100644 index 00000000000..db6759814b9 --- /dev/null +++ b/clang/test/SemaTemplate/class-template-spec.cpp @@ -0,0 +1,31 @@ +// RUN: clang -fsyntax-only -verify %s +template<typename T, typename U = int> class A; + +template<> class A<double, double>; // expected-note{{forward declaration}} + +template<> class A<float, float> { // expected-note{{previous definition}} + int x; +}; + +template<> class A<float> { // expected-note{{previous definition}} + int y; +}; + +int test_specs(A<float, float> *a1, A<float, int> *a2) { + return a1->x + a2->y; +} + +int test_incomplete_specs(A<double, double> *a1, + A<double> *a2) // FIXME: expected-note{{forward declaration}} +{ + (void)a1->x; // expected-error{{incomplete definition of type 'A<double, double>'}} + (void)a2->x; // expected-error{{incomplete definition of type 'A<double>'}} +} + +typedef float FLOAT; + +template<> class A<float, FLOAT>; + +template<> class A<FLOAT, float> { }; // expected-error{{redefinition}} + +template<> class A<float, int> { }; // expected-error{{redefinition}} |