| 1 |
// ADL can be recursive (via instantiation), make sure that works. |
| 2 |
|
| 3 |
namespace X |
| 4 |
{ |
| 5 |
class B {}; |
| 6 |
|
| 7 |
void frob (); |
| 8 |
int frob (B); // Inner ADL resolves here |
| 9 |
} |
| 10 |
|
| 11 |
void frob (int); |
| 12 |
void frob (float); |
| 13 |
|
| 14 |
namespace Y |
| 15 |
{ |
| 16 |
struct A {}; |
| 17 |
void frob (void*, void *, void *); // Outer ADL resolves here |
| 18 |
} |
| 19 |
|
| 20 |
template <typename T, typename U> |
| 21 |
struct C : U |
| 22 |
{ |
| 23 |
int ary[sizeof frob(T())]; // ADL occurs here during instantiation |
| 24 |
}; |
| 25 |
|
| 26 |
void Foo (C<X::B, Y::A> *p, X::B *q) |
| 27 |
{ |
| 28 |
frob(q, p, q); // ADL causes instantation of C<...> |
| 29 |
// We will have already searched X by the time the instantation happens |
| 30 |
} |