1 // RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s
2
3 template<typename T> struct A {
fA4 void f() { }
5 struct N { }; // expected-note{{target of using declaration}}
6 };
7
8 template<typename T> struct B : A<T> {
9 using A<T>::f;
10 using A<T>::N; // expected-error{{dependent using declaration resolved to type without 'typename'}}
11
12 using A<T>::foo; // expected-error{{no member named 'foo'}}
13 using A<double>::f; // expected-error{{using declaration refers into 'A<double>::', which is not a base class of 'B<int>'}}
14 };
15
16 B<int> a; // expected-note{{in instantiation of template class 'B<int>' requested here}}
17
18 template<typename T> struct C : A<T> {
19 using A<T>::f;
20
fC21 void f() { };
22 };
23
24 template <typename T> struct D : A<T> {
25 using A<T>::f;
26
27 void f();
28 };
29
f()30 template<typename T> void D<T>::f() { }
31
32 template<typename T> struct E : A<T> {
33 using A<T>::f;
34
gE35 void g() { f(); }
36 };
37
38 namespace test0 {
39 struct Base {
40 int foo;
41 };
42 template<typename T> struct E : Base {
43 using Base::foo;
44 };
45
46 template struct E<int>;
47 }
48
49 // PR7896
50 namespace PR7896 {
51 template <class T> struct Foo {
52 int k (float);
53 };
54 struct Baz {
55 int k (int);
56 };
57 template <class T> struct Bar : public Foo<T>, Baz {
58 using Foo<T>::k;
59 using Baz::k;
fooPR7896::Bar60 int foo() {
61 return k (1.0f);
62 }
63 };
64 template int Bar<int>::foo();
65 }
66
67 // PR10883
68 namespace PR10883 {
69 template <typename T>
70 class Base {
71 public:
72 typedef long Container;
73 };
74
75 template <typename T>
76 class Derived : public Base<T> {
77 public:
78 using Base<T>::Container;
79
80 void foo(const Container& current); // expected-error {{unknown type name 'Container'}}
81 };
82 }
83
84 template<typename T> class UsingTypenameNNS {
85 using typename T::X;
86 typename X::X x;
87 };
88
89 namespace aliastemplateinst {
90 template<typename T> struct A { };
91 template<typename T> using APtr = A<T*>; // expected-note{{previous use is here}}
92
93 template struct APtr<int>; // expected-error{{elaborated type refers to a type alias template}}
94 }
95