blob: da1eb49eb89e947e4be3815bfb5dd282b8d19126 [file] [log] [blame]
Daniel Dunbara5728872009-12-15 20:14:24 +00001// RUN: %clang_cc1 -fsyntax-only -verify %s
Douglas Gregor4a2487a2009-05-19 00:38:01 +00002
3namespace N1 {
4 struct X0 { };
5
6 int& f0(X0);
7}
8
9namespace 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
20template struct N2::call_f0<int, char&>;
21template struct N2::call_f0<N1::X0, int&>;
22
23namespace N3 {
24 template<typename T, typename Result>
25 struct call_f0 {
26 void test_f0(T t) {
Richard Smithf50e88a2011-06-05 22:42:48 +000027 Result &result = f0(t); // expected-error {{undeclared identifier}} \
Jay Foad2a00b832011-06-14 12:59:25 +000028 expected-error {{neither visible in the template definition nor found by argument-dependent lookup}}
Douglas Gregor4a2487a2009-05-19 00:38:01 +000029 }
30 };
31}
32
33template struct N3::call_f0<int, char&>; // expected-note{{instantiation}}
34template struct N3::call_f0<N1::X0, int&>;
35
Richard Smithf50e88a2011-06-05 22:42:48 +000036short& f0(char); // expected-note {{should be declared prior to the call site}}
Douglas Gregor4a2487a2009-05-19 00:38:01 +000037namespace N4 {
38 template<typename T, typename Result>
39 struct call_f0 {
40 void test_f0(T t) {
41 Result &result = f0(t);
42 }
43 };
44}
45
46template struct N4::call_f0<int, short&>;
47template struct N4::call_f0<N1::X0, int&>;
48template struct N3::call_f0<int, short&>; // expected-note{{instantiation}}
49
50// FIXME: test overloaded function call operators, calls to member
51// functions, etc.