From 222e2a7620e6520ffaf4fc4e69d79c18da31542e Mon Sep 17 00:00:00 2001 From: "Zancanaro; Carlo" Date: Mon, 24 Sep 2012 09:58:17 +1000 Subject: Add the clang library to the repo (with some of my changes, too). --- clang/test/SemaCXX/nested-name-spec-locations.cpp | 162 ++++++++++++++++++++++ 1 file changed, 162 insertions(+) create mode 100644 clang/test/SemaCXX/nested-name-spec-locations.cpp (limited to 'clang/test/SemaCXX/nested-name-spec-locations.cpp') diff --git a/clang/test/SemaCXX/nested-name-spec-locations.cpp b/clang/test/SemaCXX/nested-name-spec-locations.cpp new file mode 100644 index 0000000..048d4ba --- /dev/null +++ b/clang/test/SemaCXX/nested-name-spec-locations.cpp @@ -0,0 +1,162 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +// Note: the formatting in this test case is intentionally funny, with +// nested-name-specifiers stretched out vertically so that we can +// match up diagnostics per-line and still verify that we're getting +// good source-location information. + +namespace outer { + namespace inner { + template + struct X0 { + }; + } +} + +template +struct add_reference { + typedef T& type; +}; + +namespace outer_alias = outer; + +template +struct UnresolvedUsingValueDeclTester { + using outer::inner::X0< + typename add_reference::type + * // expected-error{{declared as a pointer to a reference of type}} + >::value; +}; + +UnresolvedUsingValueDeclTester UnresolvedUsingValueDeclCheck; // expected-note{{in instantiation of template class}} + +template +struct UnresolvedUsingTypenameDeclTester { + using outer::inner::X0< + typename add_reference::type + * // expected-error{{declared as a pointer to a reference of type}} + >::value; +}; + +UnresolvedUsingTypenameDeclTester UnresolvedUsingTypenameDeclCheck; // expected-note{{in instantiation of template class}} + + +template +struct PseudoDestructorExprTester { + void f(T *t) { + t->T::template Inner::type + * // expected-error{{as a pointer to a reference of type}} + >::Blarg::~Blarg(); + } +}; + +struct HasInnerTemplate { + template + struct Inner; + + typedef HasInnerTemplate T; +}; + +void PseudoDestructorExprCheck( + PseudoDestructorExprTester tester) { + tester.f(0); // expected-note{{in instantiation of member function}} +} + +template +struct DependentScopedDeclRefExpr { + void f() { + outer_alias::inner::X0::type + * // expected-error{{as a pointer to a reference of type}} + >::value = 17; + } +}; + +void DependentScopedDeclRefExprCheck(DependentScopedDeclRefExpr t) { + t.f(); // expected-note{{in instantiation of member function}} +} + + +template +struct TypenameTypeTester { + typedef typename outer::inner::X0< + typename add_reference::type + * // expected-error{{declared as a pointer to a reference of type}} + >::type type; +}; + +TypenameTypeTester TypenameTypeCheck; // expected-note{{in instantiation of template class}} + +template +struct DependentTemplateSpecializationTypeTester { + typedef typename T::template apply::type + * // expected-error{{declared as a pointer to a reference of type}} + >::type type; +}; + +struct HasApply { + template + struct apply { + typedef T type; + }; +}; + +DependentTemplateSpecializationTypeTester DTSTCheck; // expected-note{{in instantiation of template class}} + +template +struct DependentTemplateSpecializationTypeTester2 { + typedef typename T::template apply::type + * // expected-error{{declared as a pointer to a reference of type}} + > type; +}; + +DependentTemplateSpecializationTypeTester2 DTSTCheck2; // expected-note{{in instantiation of template class}} + +template +struct DependentTemplateSpecializationTypeTester3 : + T::template apply::type + * // expected-error{{declared as a pointer to a reference of type}} + > +{}; + +DependentTemplateSpecializationTypeTester3 DTSTCheck3; // expected-note{{in instantiation of template class}} + +template +struct DependentTemplateSpecializationTypeTester4 { + typedef class T::template apply::type + * // expected-error{{declared as a pointer to a reference of type}} + > type; +}; + +DependentTemplateSpecializationTypeTester4 DTSTCheck4; // expected-note{{in instantiation of template class}} + +template class TTP> +struct AcceptedTemplateTemplateParameter { +}; + +template +struct DependentTemplateTemplateArgumentTester { + typedef AcceptedTemplateTemplateParameter< + T:: + template apply< + typename add_reference::type + * // expected-error{{declared as a pointer to a reference of type}} + >:: + template X> + type; +}; + +DependentTemplateTemplateArgumentTester DTTACheck; // expected-note{{in instantiation of template class}} + +namespace PR9388 { + namespace std { + template class vector { + }; + } + template static void foo(std::vector &V) { + __PRETTY_FUNCTION__; // expected-warning{{expression result unused}} + } + void bar(std::vector &Blocks) { + foo(Blocks); // expected-note{{in instantiation of}} + } + +} -- cgit v1.2.3