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/using-decl-templates.cpp | 82 +++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 clang/test/SemaCXX/using-decl-templates.cpp (limited to 'clang/test/SemaCXX/using-decl-templates.cpp') diff --git a/clang/test/SemaCXX/using-decl-templates.cpp b/clang/test/SemaCXX/using-decl-templates.cpp new file mode 100644 index 0000000..2f8abca --- /dev/null +++ b/clang/test/SemaCXX/using-decl-templates.cpp @@ -0,0 +1,82 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +template struct A { + void f() { } + struct N { }; // expected-note{{target of using declaration}} +}; + +template struct B : A { + using A::f; + using A::N; // expected-error{{dependent using declaration resolved to type without 'typename'}} + + using A::foo; // expected-error{{no member named 'foo'}} + using A::f; // expected-error{{using declaration refers into 'A::', which is not a base class of 'B'}} +}; + +B a; // expected-note{{in instantiation of template class 'B' requested here}} + +template struct C : A { + using A::f; + + void f() { }; +}; + +template struct D : A { + using A::f; + + void f(); +}; + +template void D::f() { } + +template struct E : A { + using A::f; + + void g() { f(); } +}; + +namespace test0 { + struct Base { + int foo; + }; + template struct E : Base { + using Base::foo; + }; + + template struct E; +} + +// PR7896 +namespace PR7896 { +template struct Foo { + int k (float); +}; +struct Baz { + int k (int); +}; +template struct Bar : public Foo, Baz { + using Foo::k; + using Baz::k; + int foo() { + return k (1.0f); + } +}; +template int Bar::foo(); +} + +// PR10883 +namespace PR10883 { + template + class Base { + public: + typedef long Container; + }; + + template + class Derived : public Base { + public: + using Base::Container; + + void foo(const Container& current); // expected-error {{unknown type name 'Container'}} + }; +} -- cgit v1.2.3