| 1 |
// Testcase from [namespace.udecl] updated by P1787 |
| 2 |
|
| 3 |
namespace A { |
| 4 |
int x; |
| 5 |
int f(int); |
| 6 |
int g; |
| 7 |
void h(); |
| 8 |
} |
| 9 |
|
| 10 |
namespace B { |
| 11 |
int i; |
| 12 |
struct g { }; |
| 13 |
struct x { }; |
| 14 |
void f(int); |
| 15 |
void f(double); |
| 16 |
void g(char); // OK: hides struct g |
| 17 |
} |
| 18 |
|
| 19 |
void func() { |
| 20 |
int i; |
| 21 |
using B::i; // { dg-error "" } i conflicts |
| 22 |
void f(char); |
| 23 |
using B::f; // OK: each f is a function |
| 24 |
using A::f; // OK, but interferes with B::f(int) |
| 25 |
f(1); // { dg-error "" } ambiguous |
| 26 |
static_cast<int(*)(int)>(f)(1); // OK: calls A::f |
| 27 |
f(3.5); // calls B::f(double) |
| 28 |
using B::g; |
| 29 |
g('a'); // calls B::g(char) |
| 30 |
struct g g1; // g1 has class type B::g |
| 31 |
using A::g; // { dg-error "" } conflicts with B::g |
| 32 |
void h(); |
| 33 |
using A::h; // { dg-error "" } conflicts |
| 34 |
using B::x; |
| 35 |
using A::x; // OK: hides struct B::x |
| 36 |
x = 99; // assigns to A::x |
| 37 |
struct x x1; // x1 has class type B::x |
| 38 |
} |