1*67e74705SXin Li // RUN: %clang_cc1 -fsyntax-only -verify %s 2*67e74705SXin Li 3*67e74705SXin Li namespace N1 { 4*67e74705SXin Li struct X0 { }; 5*67e74705SXin Li 6*67e74705SXin Li int& f0(X0); 7*67e74705SXin Li } 8*67e74705SXin Li 9*67e74705SXin Li namespace N2 { 10*67e74705SXin Li char& f0(char); 11*67e74705SXin Li 12*67e74705SXin Li template<typename T, typename Result> 13*67e74705SXin Li struct call_f0 { test_f0N2::call_f014*67e74705SXin Li void test_f0(T t) { 15*67e74705SXin Li Result result = f0(t); 16*67e74705SXin Li } 17*67e74705SXin Li }; 18*67e74705SXin Li } 19*67e74705SXin Li 20*67e74705SXin Li template struct N2::call_f0<int, char&>; 21*67e74705SXin Li template struct N2::call_f0<N1::X0, int&>; 22*67e74705SXin Li 23*67e74705SXin Li namespace N3 { 24*67e74705SXin Li template<typename T, typename Result> 25*67e74705SXin Li struct call_f0 { test_f0N3::call_f026*67e74705SXin Li void test_f0(T t) { 27*67e74705SXin Li Result &result = f0(t); // expected-error {{undeclared identifier}} \ 28*67e74705SXin Li expected-error {{neither visible in the template definition nor found by argument-dependent lookup}} 29*67e74705SXin Li } 30*67e74705SXin Li }; 31*67e74705SXin Li } 32*67e74705SXin Li 33*67e74705SXin Li template struct N3::call_f0<int, char&>; // expected-note{{instantiation}} 34*67e74705SXin Li template struct N3::call_f0<N1::X0, int&>; 35*67e74705SXin Li 36*67e74705SXin Li short& f0(char); // expected-note {{should be declared prior to the call site}} 37*67e74705SXin Li namespace N4 { 38*67e74705SXin Li template<typename T, typename Result> 39*67e74705SXin Li struct call_f0 { test_f0N4::call_f040*67e74705SXin Li void test_f0(T t) { 41*67e74705SXin Li Result &result = f0(t); 42*67e74705SXin Li } 43*67e74705SXin Li }; 44*67e74705SXin Li } 45*67e74705SXin Li 46*67e74705SXin Li template struct N4::call_f0<int, short&>; 47*67e74705SXin Li template struct N4::call_f0<N1::X0, int&>; 48*67e74705SXin Li template struct N3::call_f0<int, short&>; // expected-note{{instantiation}} 49*67e74705SXin Li 50*67e74705SXin Li // FIXME: test overloaded function call operators, calls to member 51*67e74705SXin Li // functions, etc. 52