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
10struct 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 *-*-* } 14 }
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 "does not name a type" }
23};
24
25struct Q;
26struct 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  };
38  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
45struct ::C {          // { dg-error "invalid before" } extra qualification
46  int i;
47};
48
49namespace N {
50  int fn();
51  struct F;
52}
53
54namespace NMS
55{
56  void NMS::fn();     // { dg-error "explicit qual" }
57  int NMS::i;         // { dg-error "explicit qual" }
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  };
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
75NMS::D thing;         // { dg-error "'D' in namespace 'NMS' does not name a type" }
76void NMS::fn()
77{
78  i = 3;
79}
80