Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify %s |
Douglas Gregor | 4a2487a | 2009-05-19 00:38:01 +0000 | [diff] [blame] | 2 | |
| 3 | namespace N1 { |
| 4 | struct X0 { }; |
| 5 | |
| 6 | int& f0(X0); |
| 7 | } |
| 8 | |
| 9 | namespace N2 { |
| 10 | char& f0(char); |
| 11 | |
| 12 | template<typename T, typename Result> |
| 13 | struct call_f0 { |
| 14 | void test_f0(T t) { |
| 15 | Result result = f0(t); |
| 16 | } |
| 17 | }; |
| 18 | } |
| 19 | |
| 20 | template struct N2::call_f0<int, char&>; |
| 21 | template struct N2::call_f0<N1::X0, int&>; |
| 22 | |
| 23 | namespace N3 { |
| 24 | template<typename T, typename Result> |
| 25 | struct call_f0 { |
| 26 | void test_f0(T t) { |
John McCall | 578b69b | 2009-12-16 08:11:27 +0000 | [diff] [blame^] | 27 | Result &result = f0(t); // expected-error 2{{undeclared identifier}} |
Douglas Gregor | 4a2487a | 2009-05-19 00:38:01 +0000 | [diff] [blame] | 28 | } |
| 29 | }; |
| 30 | } |
| 31 | |
| 32 | template struct N3::call_f0<int, char&>; // expected-note{{instantiation}} |
| 33 | template struct N3::call_f0<N1::X0, int&>; |
| 34 | |
| 35 | short& f0(char); |
| 36 | namespace N4 { |
| 37 | template<typename T, typename Result> |
| 38 | struct call_f0 { |
| 39 | void test_f0(T t) { |
| 40 | Result &result = f0(t); |
| 41 | } |
| 42 | }; |
| 43 | } |
| 44 | |
| 45 | template struct N4::call_f0<int, short&>; |
| 46 | template struct N4::call_f0<N1::X0, int&>; |
| 47 | template struct N3::call_f0<int, short&>; // expected-note{{instantiation}} |
| 48 | |
| 49 | // FIXME: test overloaded function call operators, calls to member |
| 50 | // functions, etc. |