view gcc/testsuite/g++.dg/lookup/koenig14.C @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
line wrap: on
line source

// ADL can be recursive (via instantiation), make sure that works.

namespace X
{
  class B {};
  
  void frob ();
  int frob (B); // Inner ADL resolves here
}

void frob (int);
void frob (float);

namespace Y
{
  struct A {};
  void frob (void*, void *, void *); // Outer ADL resolves here
}

template <typename T, typename U>
struct C : U
{
  int ary[sizeof frob(T())]; // ADL occurs here during instantiation
};

void Foo (C<X::B, Y::A> *p, X::B *q)
{
  frob(q, p, q); // ADL causes instantation of C<...>
  // We will have already searched X by the time the instantation happens
}