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.
9namespace N {
10  struct A { };
11  struct B : public A { };
12
13  int& f0(A&);
14}
15
16template<typename T, typename Result>
17struct X0 {
18  void test_f0(T t) {
19    Result r = f0(t);
20  };
21};
22
23void 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
30namespace N {
31  char& f0(B&);
32}
33