From 4c8b24812ddcd1dedaca343a6d4e76f91f398981 Mon Sep 17 00:00:00 2001 From: Roman Divacky Date: Wed, 14 Oct 2009 18:03:49 +0000 Subject: Update clang to r84119. --- test/SemaTemplate/class-template-spec.cpp | 34 +++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) (limited to 'test/SemaTemplate/class-template-spec.cpp') diff --git a/test/SemaTemplate/class-template-spec.cpp b/test/SemaTemplate/class-template-spec.cpp index 71d8ea14be6b..e44115c748c3 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 struct A; // expected-note 2{{template is declared here}} +template struct A; // expected-note {{template is declared here}} \ + // expected-note{{explicitly specialized}} template<> struct A; // expected-note{{forward declaration}} @@ -19,7 +20,8 @@ int test_incomplete_specs(A *a1, A *a2) { (void)a1->x; // expected-error{{incomplete definition of type 'A'}} - (void)a2->x; // expected-error{{implicit instantiation of undefined template 'struct A'}} + (void)a2->x; // expected-error{{implicit instantiation of undefined template 'struct A'}} \ + // expected-note{{first required here}} } typedef float FLOAT; @@ -49,13 +51,33 @@ struct A { A::A() { } +// Make sure we can see specializations defined before the primary template. +namespace N{ + template struct A0; +} + +namespace N { + template<> + struct A0 { + typedef void* pointer; + }; +} + +namespace N { + template + struct A0 { + void foo(A0::pointer p = 0); + }; +} + // Diagnose specialization errors -struct A { }; // expected-error{{template specialization requires 'template<>'}} +struct A { }; // expected-error{{template specialization requires 'template<>'}} \ + // expected-error{{after instantiation}} template<> struct ::A; namespace N { - template struct B; // expected-note 2{{template is declared here}} + template struct B; // expected-note 2{{explicitly specialized}} template<> struct ::N::B; // okay template<> struct ::N::B; // okay @@ -66,12 +88,12 @@ namespace N { template<> struct N::B { }; // okay -template<> struct N::B { }; // expected-error{{class template specialization of 'B' not in namespace 'N'}} +template<> struct N::B { }; // expected-error{{originally}} namespace M { template<> struct ::N::B { }; // expected-error{{class template specialization of 'B' not in a namespace enclosing 'N'}} - template<> struct ::A; // expected-error{{class template specialization of 'A' must occur in the global scope}} + template<> struct ::A; // expected-error{{originally}} } template<> struct N::B { -- cgit v1.3