aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/parse/semicolon3.C
blob: 8a2b1ac46301f6a0ee7f18cfff3b391f0f58db5d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
// PR c++/45331
// { dg-do compile }
// { dg-options -std=c++98 }

struct OK1
{
  int a;
} // no complaints
  *s5;

struct OK2
{
  int a;
} // no complaints
  &s6 = *(new OK2());

struct OK3
{
  int a;
} // no complaints
  (s7);

__SIZE_TYPE__
test_offsetof (void)
{
  // no complaints about a missing semicolon
  return __builtin_offsetof (struct OK4 { int a; int b; }, b);
}

struct OK5
{
  int a;
} ok5_var;			// no complaints

struct OK6
{
  int a;
} static ok6_var;		// no complaints

class OK7
{
public:
  OK7() { };
  int a;
} const ok7_var;		// no complaints

class OK8
{
  int a;
} extern ok8_var;		// no complaints

class OK9
{
  class OK9sub { int a; } mutable ok9sub; // no complaints
  int a;
};

int
autotest (void)
{
  struct OK10 { int a; } auto ok10 = { 0 }; // no complaints

  return ok10.a;
}

struct OK11
{
  int a;
} // no complaints
  const *ok11_var;

struct OK12
{
  int a;
} // no complaints
  const &ok12_var = *(new OK12());

struct OK13
{
  int a;
} // no complaints
  static *ok13_var;

class OK14
{
  struct OK14sub
  {
    int a;
  } // no complaints
    static &ok14_var;
};

class OK15
{
  int a;
} typedef tOK15;

class OK16
{
  int a;
} typedef *pOK16;

class OK17
{
  int a;
} typedef &rOK16;

struct E1
{
  int a;
} // { dg-error "after struct definition" }

typedef float BAR;

struct E2
{
  int a;
} // { dg-error "after struct definition" }

const int i0 = 1;

struct E3
{
  int a;
} // { dg-error "after struct definition" }

volatile long l0 = 1;

struct E4
{
  int a;
} // { dg-error "after struct definition" }

extern char c0;

struct E5
{
  int a;
} // { dg-error "after struct definition" }

static wchar_t wc0;

struct E6
{
  int a;
} // { dg-error "after struct definition" }

bool b0;

class E7
{
  int a;
} // { dg-error "after class definition" }

extern double d0;

class E8
{
  int a;
} // { dg-error "after class definition" }

inline short f(void)
{
  return 2;
}

class E9
{
  int a;
} // { dg-error "after class definition" }

class D0
{
  int a;
};

class E10
{
  int a;
} // { dg-error "after class definition" }

extern class D0 &f0 (void);

class E11
{
  int a;
} // { dg-error "after class definition" }

const struct E6 *f1 (void) { return 0; }

union U0 {
  int i;
  double d;
};

class E12
{
  int a;
} // { dg-error "after class definition" }

const union U0 *f2 (void) { return 0; }

enum e {
  U, V
};

class E13
{
  int a;
} // { dg-error "after class definition" }

static enum e f3 (void) { return U; }

union E14
{
  int i;
  double d;
} // { dg-error "after union definition" }

unsigned int i1 = 2;

union E15
{
  int i;
  double d;
} // { dg-error "after union definition" }

signed long l1 = 3;

class E16
{
  class sub0 { int a; }		// { dg-error "after class definition" }
    virtual int f2 (void);
} // { dg-error "after class definition" }

class E17
{
  class sub0 { int a; }		// { dg-error "after class definition" }
    mutable int i;
} // { dg-error "after class definition" }

class E18
{
  int a;
} // { dg-error "after class definition" }

typedef int E18int;

/* This was the original test from the PR.  */

class C0
{
public:
 int a;
} // { dg-error "after class definition" }

const int foo(const C0 &x)
{
 return x.a;
}