1 // { dg-do assemble }
2
3 // Copyright (C) 1999, 2000, 2002, 2003 Free Software Foundation, Inc.
4 // Contributed by Nathan Sidwell 22 Apr 1999 <nathan@acm.org>
5 // derived from a bug report by <rch@larissa.sd.bi.ruhr-uni-bochum.de>
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 "extra qualification" }
12 int A::m; // { dg-error "extra qualification" }
13 struct e;
14 struct A::e {int i;}; // { dg-error "extra qualification" "qual" }
15 // { dg-error "anonymous struct" "anon" { target *-*-* } .-1 }
16 struct A::expand { // { dg-error "qualified name" }
17 int m;
18 };
19 struct Z;
20 expand me; // { dg-error "'expand' does not name a type" }
21 void foo(struct A::e);
22 void foo(struct A::z); // { dg-error "incomplete" }
23 };
24
25 struct Q;
26 struct B {
27 struct A::fink { // { dg-error "does not name a class before" }
28 int m;
29 };
30 struct A::Z { // { dg-error "does not enclose" } A::Z not a member of B
31 int m;
32 };
33 int m;
34 int n;
35 struct ::Q { // { dg-error "global qual" } ::Q not a member of B
36 int m;
37 };
fnB38 int A::fn() { // { dg-error "cannot define member" } A::fn not a member of B
39 return 0;
40 }
41 void fn(struct ::Q &);
42 void foo(struct A::y); // { dg-error "does not name a type" } no such member
43 };
44
45 struct ::C { // { dg-error "invalid before" } extra qualification
46 int i;
47 };
48
49 namespace N {
50 int fn();
51 struct F;
52 }
53
54 namespace NMS
55 {
56 void NMS::fn(); // { dg-error "should have been" }
57 int NMS::i; // { dg-error "should have been" }
58 struct NMS::D { // { dg-error "does not name a class" }
59 int i;
60 };
61 struct N::E { // { dg-error "does not name a class" } no such type
62 int i;
63 };
64 struct ::F { // { dg-error "global qual" } no such type
65 int i;
66 };
fn()67 int N::fn() { // { dg-error "namespace" } N::fn not a member of NMS
68 return 0;
69 }
70 struct N::F { // { dg-error "namespace" } N::F not a member of NMS
71 int i;
72 };
73 }
74
75 NMS::D thing; // { dg-error "'D' in namespace 'NMS' does not name a type" }
fn()76 void NMS::fn()
77 {
78 i = 3;
79 }
80
81 // From PR c++/15766 - bad parse error recovery (2 bugs)
confusion1(const UndefinedType & a)82 void confusion1(const UndefinedType& a) // { dg-error "does not name a type" }
83 {
84 }
85
86