| 1 |
// { dg-do assemble } |
| 2 |
|
| 3 |
// Copyright (C) 1999, 2000, 2002, 2003 Free Software Foundation, Inc. |
| 4 |
// Contributed by Nathan Sidwell 22 Apr 1999 <[email protected]> |
| 5 |
// derived from a bug report by <[email protected]> |
| 6 |
// http://gcc.gnu.org/ml/gcc-bugs/1999-04n/msg00631.html |
| 7 |
// the code is wrong, but we fell over badly |
| 8 |
|
| 9 |
|
| 10 |
struct A { |
| 11 |
int A::fn(); // { dg-error "7:extra qualification" } |
| 12 |
int A::m; // { dg-error "7:extra qualification" } |
| 13 |
struct e; |
| 14 |
struct A::e {int i;}; // { dg-error "10:extra qualification" "qual" } |
| 15 |
struct A::expand { // { dg-error "qualified name" } |
| 16 |
int m; |
| 17 |
}; |
| 18 |
struct Z; |
| 19 |
expand me; // { dg-error "'expand' does not name a type" } |
| 20 |
void foo(struct A::e); |
| 21 |
void foo(struct A::z); // { dg-error "does not name a type" } |
| 22 |
}; |
| 23 |
|
| 24 |
struct Q; |
| 25 |
struct B { |
| 26 |
struct A::fink { // { dg-error "does not name a class before" } |
| 27 |
int m; |
| 28 |
}; |
| 29 |
struct A::Z { // { dg-error "does not enclose" } A::Z not a member of B |
| 30 |
int m; |
| 31 |
}; |
| 32 |
int m; |
| 33 |
int n; |
| 34 |
struct ::Q { // { dg-error "global qual" } ::Q not a member of B |
| 35 |
int m; |
| 36 |
}; |
| 37 |
int A::fn() { // { dg-error "7:cannot define member" } A::fn not a member of B |
| 38 |
return 0; |
| 39 |
} |
| 40 |
void fn(struct ::Q &); |
| 41 |
void foo(struct A::y); // { dg-error "does not name a type" } no such member |
| 42 |
}; |
| 43 |
|
| 44 |
struct ::C { // { dg-error "invalid before" } extra qualification |
| 45 |
int i; |
| 46 |
}; |
| 47 |
|
| 48 |
namespace N { |
| 49 |
int fn(); |
| 50 |
struct F; |
| 51 |
} |
| 52 |
|
| 53 |
namespace NMS |
| 54 |
{ |
| 55 |
void NMS::fn(); // { dg-error "should have been" } |
| 56 |
int NMS::i; // { dg-error "should have been" } |
| 57 |
struct NMS::D { // { dg-error "does not name a class" } |
| 58 |
int i; |
| 59 |
}; |
| 60 |
struct N::E { // { dg-error "does not name a class" } no such type |
| 61 |
int i; |
| 62 |
}; |
| 63 |
struct ::F { // { dg-error "global qual" } no such type |
| 64 |
int i; |
| 65 |
}; |
| 66 |
int N::fn() { // { dg-error "namespace" } N::fn not a member of NMS |
| 67 |
return 0; |
| 68 |
} |
| 69 |
struct N::F { // { dg-error "namespace" } N::F not a member of NMS |
| 70 |
int i; |
| 71 |
}; |
| 72 |
} |
| 73 |
|
| 74 |
NMS::D thing; // { dg-error "'D' in namespace 'NMS' does not name a type" } |
| 75 |
void NMS::fn() |
| 76 |
{ |
| 77 |
i = 3; |
| 78 |
} |
| 79 |
|
| 80 |
// From PR c++/15766 - bad parse error recovery (2 bugs) |
| 81 |
void confusion1(const UndefinedType& a) // { dg-error "does not name a type" } |
| 82 |
{ |
| 83 |
} |
| 84 |
|