| 1 |
// PR c++/77549 |
| 2 |
// { dg-do compile } |
| 3 |
|
| 4 |
struct A |
| 5 |
{ |
| 6 |
static int x; |
| 7 |
}; |
| 8 |
|
| 9 |
void |
| 10 |
f1 () |
| 11 |
{ |
| 12 |
using ::A; |
| 13 |
x; // { dg-error "'x' was not declared in this scope" } |
| 14 |
} |
| 15 |
|
| 16 |
namespace N |
| 17 |
{ |
| 18 |
int bar; |
| 19 |
} |
| 20 |
|
| 21 |
void |
| 22 |
f2 () |
| 23 |
{ |
| 24 |
using N::bar; |
| 25 |
baz++; // { dg-error "'baz' was not declared in this scope; did you mean 'bar'\\?" } |
| 26 |
} |
| 27 |
|
| 28 |
int |
| 29 |
bar () |
| 30 |
{ |
| 31 |
return 0; |
| 32 |
} |
| 33 |
|
| 34 |
namespace M |
| 35 |
{ |
| 36 |
int |
| 37 |
bar () |
| 38 |
{ |
| 39 |
return 0; |
| 40 |
} |
| 41 |
} |
| 42 |
|
| 43 |
void |
| 44 |
f3 () |
| 45 |
{ |
| 46 |
using M::bar; |
| 47 |
baz (); // { dg-error "'baz' was not declared in this scope; did you mean 'bar'\\?" } |
| 48 |
} |
| 49 |
|
| 50 |
namespace O |
| 51 |
{ |
| 52 |
int |
| 53 |
foo () |
| 54 |
{ |
| 55 |
return 0; |
| 56 |
} |
| 57 |
} |
| 58 |
|
| 59 |
namespace P |
| 60 |
{ |
| 61 |
int |
| 62 |
bar () |
| 63 |
{ |
| 64 |
return 0; |
| 65 |
} |
| 66 |
} |
| 67 |
|
| 68 |
void |
| 69 |
f4 () |
| 70 |
{ |
| 71 |
using O::foo; |
| 72 |
using P::bar; |
| 73 |
fooo (); // { dg-error "'fooo' was not declared in this scope; did you mean 'foo'\\?" } |
| 74 |
baz (); // { dg-error "'baz' was not declared in this scope; did you mean 'bar'\\?" } |
| 75 |
} |