Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify %s |
Anders Carlsson | 0dde18e | 2009-08-28 15:18:15 +0000 | [diff] [blame] | 2 | |
| 3 | template<typename T> struct A { |
| 4 | void f() { } |
John McCall | 7ba107a | 2009-11-18 02:36:19 +0000 | [diff] [blame] | 5 | struct N { }; // expected-note{{target of using declaration}} |
Anders Carlsson | 0dde18e | 2009-08-28 15:18:15 +0000 | [diff] [blame] | 6 | }; |
| 7 | |
| 8 | template<typename T> struct B : A<T> { |
| 9 | using A<T>::f; |
John McCall | 7ba107a | 2009-11-18 02:36:19 +0000 | [diff] [blame] | 10 | using A<T>::N; // expected-error{{dependent using declaration resolved to type without 'typename'}} |
Anders Carlsson | 0dde18e | 2009-08-28 15:18:15 +0000 | [diff] [blame] | 11 | |
| 12 | using A<T>::foo; // expected-error{{no member named 'foo'}} |
John McCall | 604e7f1 | 2009-12-08 07:46:18 +0000 | [diff] [blame] | 13 | using A<double>::f; // expected-error{{using declaration refers into 'A<double>::', which is not a base class of 'B<int>'}} |
Anders Carlsson | 0dde18e | 2009-08-28 15:18:15 +0000 | [diff] [blame] | 14 | }; |
| 15 | |
John McCall | 7c2342d | 2010-03-10 11:27:22 +0000 | [diff] [blame] | 16 | B<int> a; // expected-note{{in instantiation of template class 'B<int>' requested here}} |
Anders Carlsson | 36ef078 | 2009-08-28 17:57:07 +0000 | [diff] [blame] | 17 | |
| 18 | template<typename T> struct C : A<T> { |
| 19 | using A<T>::f; |
| 20 | |
| 21 | void f() { }; |
| 22 | }; |
Anders Carlsson | 203cb71 | 2009-08-29 00:56:38 +0000 | [diff] [blame] | 23 | |
| 24 | template <typename T> struct D : A<T> { |
| 25 | using A<T>::f; |
| 26 | |
| 27 | void f(); |
| 28 | }; |
| 29 | |
| 30 | template<typename T> void D<T>::f() { } |
Anders Carlsson | 598da5b | 2009-08-29 01:06:32 +0000 | [diff] [blame] | 31 | |
| 32 | template<typename T> struct E : A<T> { |
| 33 | using A<T>::f; |
| 34 | |
| 35 | void g() { f(); } |
| 36 | }; |
John McCall | ed97649 | 2009-12-04 22:46:56 +0000 | [diff] [blame] | 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 | } |