| 1 |
// PR c++/95074 - Function found via ADL when it should not. |
| 2 |
// { dg-do compile } |
| 3 |
|
| 4 |
namespace N { |
| 5 |
struct S { }; |
| 6 |
void f(S); |
| 7 |
void g(S); |
| 8 |
} |
| 9 |
|
| 10 |
namespace M { |
| 11 |
void f(int); |
| 12 |
void g(int); |
| 13 |
} |
| 14 |
|
| 15 |
void |
| 16 |
fn0 () |
| 17 |
{ |
| 18 |
N::S s; |
| 19 |
using M::f; |
| 20 |
f (s); |
| 21 |
} |
| 22 |
|
| 23 |
void |
| 24 |
fn1 () |
| 25 |
{ |
| 26 |
N::S s; |
| 27 |
extern void f(char); |
| 28 |
using M::f; |
| 29 |
f (s); // { dg-error "no matching function" } |
| 30 |
} |
| 31 |
|
| 32 |
void |
| 33 |
fn2 () |
| 34 |
{ |
| 35 |
N::S s; |
| 36 |
using M::f; |
| 37 |
extern void f(char); |
| 38 |
f (s); // { dg-error "no matching function" } |
| 39 |
} |
| 40 |
|
| 41 |
void |
| 42 |
fn3 () |
| 43 |
{ |
| 44 |
N::S s; |
| 45 |
extern void (*g)(char); |
| 46 |
g (s); // { dg-error "cannot convert" } |
| 47 |
} |