diff options
author | rdivacky <rdivacky@FreeBSD.org> | 2009-10-14 18:03:49 +0000 |
---|---|---|
committer | rdivacky <rdivacky@FreeBSD.org> | 2009-10-14 18:03:49 +0000 |
commit | 9092c3e0fa01f3139b016d05d267a89e3b07747a (patch) | |
tree | 137ebebcae16fb0ce7ab4af456992bbd8d22fced /test/SemaTemplate/class-template-spec.cpp | |
parent | 4981926bf654fe5a2c3893f24ca44106b217e71e (diff) | |
download | FreeBSD-src-9092c3e0fa01f3139b016d05d267a89e3b07747a.zip FreeBSD-src-9092c3e0fa01f3139b016d05d267a89e3b07747a.tar.gz |
Update clang to r84119.
Diffstat (limited to 'test/SemaTemplate/class-template-spec.cpp')
-rw-r--r-- | test/SemaTemplate/class-template-spec.cpp | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/test/SemaTemplate/class-template-spec.cpp b/test/SemaTemplate/class-template-spec.cpp index 71d8ea1..e44115c 100644 --- a/test/SemaTemplate/class-template-spec.cpp +++ b/test/SemaTemplate/class-template-spec.cpp @@ -1,5 +1,6 @@ // RUN: clang-cc -fsyntax-only -verify %s -template<typename T, typename U = int> struct A; // expected-note 2{{template is declared here}} +template<typename T, typename U = int> struct A; // expected-note {{template is declared here}} \ + // expected-note{{explicitly specialized}} template<> struct A<double, double>; // expected-note{{forward declaration}} @@ -19,7 +20,8 @@ int test_incomplete_specs(A<double, double> *a1, A<double> *a2) { (void)a1->x; // expected-error{{incomplete definition of type 'A<double, double>'}} - (void)a2->x; // expected-error{{implicit instantiation of undefined template 'struct A<double, int>'}} + (void)a2->x; // expected-error{{implicit instantiation of undefined template 'struct A<double, int>'}} \ + // expected-note{{first required here}} } typedef float FLOAT; @@ -49,13 +51,33 @@ struct A<char> { A<char>::A() { } +// Make sure we can see specializations defined before the primary template. +namespace N{ + template<typename T> struct A0; +} + +namespace N { + template<> + struct A0<void> { + typedef void* pointer; + }; +} + +namespace N { + template<typename T> + struct A0 { + void foo(A0<void>::pointer p = 0); + }; +} + // Diagnose specialization errors -struct A<double> { }; // expected-error{{template specialization requires 'template<>'}} +struct A<double> { }; // expected-error{{template specialization requires 'template<>'}} \ + // expected-error{{after instantiation}} template<> struct ::A<double>; namespace N { - template<typename T> struct B; // expected-note 2{{template is declared here}} + template<typename T> struct B; // expected-note 2{{explicitly specialized}} template<> struct ::N::B<char>; // okay template<> struct ::N::B<short>; // okay @@ -66,12 +88,12 @@ namespace N { template<> struct N::B<int> { }; // okay -template<> struct N::B<float> { }; // expected-error{{class template specialization of 'B' not in namespace 'N'}} +template<> struct N::B<float> { }; // expected-error{{originally}} namespace M { template<> struct ::N::B<short> { }; // expected-error{{class template specialization of 'B' not in a namespace enclosing 'N'}} - template<> struct ::A<long double>; // expected-error{{class template specialization of 'A' must occur in the global scope}} + template<> struct ::A<long double>; // expected-error{{originally}} } template<> struct N::B<char> { |