1 // RUN: %clang_cc1 -fsyntax-only -verify %s
2 // XFAIL: *
3 
4 // Note: we fail this test because we perform template instantiation
5 // at the end of the translation unit, so argument-dependent lookup
6 // finds functions that occur after the point of instantiation. Note
7 // that GCC fails this test; EDG passes the test in strict mode, but
8 // not in relaxed mode.
9 namespace N {
10   struct A { };
11   struct B : public A { };
12 
13   int& f0(A&);
14 }
15 
16 template<typename T, typename Result>
17 struct X0 {
test_f0X018   void test_f0(T t) {
19     Result r = f0(t);
20   };
21 };
22 
test_f0()23 void test_f0() {
24   X0<N::A, int&> xA;
25   xA.test_f0(N::A());
26   X0<N::B, int&> xB;
27   xB.test_f0(N::B());
28 }
29 
30 namespace N {
31   char& f0(B&);
32 }
33