view gcc/testsuite/g++.dg/lookup/koenig14.C @ 152:2b5abeee2509

update gcc11
author anatofuz
date Mon, 25 May 2020 07:50:57 +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
}