1// RUN: %clang_cc1 -fsyntax-only -fopenmp=libiomp5 -x c++ -std=c++11 -fexceptions -fcxx-exceptions -verify %s
2
3static int sii;
4#pragma omp threadprivate(sii) // expected-note {{defined as threadprivate or thread local}}
5
6int test_iteration_spaces() {
7  const int N = 100;
8  float a[N], b[N], c[N];
9  int ii, jj, kk;
10  float fii;
11  double dii;
12  #pragma omp simd
13  for (int i = 0; i < 10; i+=1) {
14    c[i] = a[i] + b[i];
15  }
16  #pragma omp simd
17  for (char i = 0; i < 10; i++) {
18    c[i] = a[i] + b[i];
19  }
20  #pragma omp simd
21  for (char i = 0; i < 10; i+='\1') {
22    c[i] = a[i] + b[i];
23  }
24  #pragma omp simd
25  for (long long i = 0; i < 10; i++) {
26    c[i] = a[i] + b[i];
27  }
28  // expected-error@+2 {{expression must have integral or unscoped enumeration type, not 'double'}}
29  #pragma omp simd
30  for (long long i = 0; i < 10; i+=1.5) {
31    c[i] = a[i] + b[i];
32  }
33  #pragma omp simd
34  for (long long i = 0; i < 'z'; i+=1u) {
35    c[i] = a[i] + b[i];
36  }
37  // expected-error@+2 {{variable must be of integer or random access iterator type}}
38  #pragma omp simd
39  for (float fi = 0; fi < 10.0; fi++) {
40    c[(int)fi] = a[(int)fi] + b[(int)fi];
41  }
42  // expected-error@+2 {{variable must be of integer or random access iterator type}}
43  #pragma omp simd
44  for (double fi = 0; fi < 10.0; fi++) {
45    c[(int)fi] = a[(int)fi] + b[(int)fi];
46  }
47  // expected-error@+2 {{variable must be of integer or random access iterator type}}
48  #pragma omp simd
49  for (int &ref = ii; ref < 10; ref++) {
50  }
51  // expected-error@+2 {{initialization clause of OpenMP for loop must be of the form 'var = init' or 'T var = init'}}
52  #pragma omp simd
53  for (int i; i < 10; i++)
54    c[i] = a[i];
55
56  // expected-error@+2 {{initialization clause of OpenMP for loop must be of the form 'var = init' or 'T var = init'}}
57  #pragma omp simd
58  for (int i = 0, j = 0; i < 10; ++i)
59    c[i] = a[i];
60
61  // expected-error@+2 {{initialization clause of OpenMP for loop must be of the form 'var = init' or 'T var = init'}}
62  #pragma omp simd
63  for (;ii < 10; ++ii)
64    c[ii] = a[ii];
65
66  // expected-warning@+3 {{expression result unused}}
67  // expected-error@+2 {{initialization clause of OpenMP for loop must be of the form 'var = init' or 'T var = init'}}
68  #pragma omp simd
69  for (ii + 1;ii < 10; ++ii)
70    c[ii] = a[ii];
71
72  // expected-error@+2 {{initialization clause of OpenMP for loop must be of the form 'var = init' or 'T var = init'}}
73  #pragma omp simd
74  for (c[ii] = 0;ii < 10; ++ii)
75    c[ii] = a[ii];
76
77  // Ok to skip parenthesises.
78  #pragma omp simd
79  for (((ii)) = 0;ii < 10; ++ii)
80    c[ii] = a[ii];
81
82  // expected-error@+2 {{condition of OpenMP for loop must be a relational comparison ('<', '<=', '>', or '>=') of loop variable 'i'}}
83  #pragma omp simd
84  for (int i = 0; i; i++)
85    c[i] = a[i];
86
87  // expected-error@+3 {{condition of OpenMP for loop must be a relational comparison ('<', '<=', '>', or '>=') of loop variable 'i'}}
88  // expected-error@+2 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'i'}}
89  #pragma omp simd
90  for (int i = 0; jj < kk; ii++)
91    c[i] = a[i];
92
93  // expected-error@+2 {{condition of OpenMP for loop must be a relational comparison ('<', '<=', '>', or '>=') of loop variable 'i'}}
94  #pragma omp simd
95  for (int i = 0; !!i; i++)
96    c[i] = a[i];
97
98  // expected-error@+2 {{condition of OpenMP for loop must be a relational comparison ('<', '<=', '>', or '>=') of loop variable 'i'}}
99  #pragma omp simd
100  for (int i = 0; i != 1; i++)
101    c[i] = a[i];
102
103  // expected-error@+2 {{condition of OpenMP for loop must be a relational comparison ('<', '<=', '>', or '>=') of loop variable 'i'}}
104  #pragma omp simd
105  for (int i = 0; ; i++)
106    c[i] = a[i];
107
108  // Ok.
109  #pragma omp simd
110  for (int i = 11; i > 10; i--)
111    c[i] = a[i];
112
113  // Ok.
114  #pragma omp simd
115  for (int i = 0; i < 10; ++i)
116    c[i] = a[i];
117
118    // Ok.
119  #pragma omp simd
120  for (ii = 0; ii < 10; ++ii)
121    c[ii] = a[ii];
122
123  // expected-error@+2 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'ii'}}
124  #pragma omp simd
125  for (ii = 0; ii < 10; ++jj)
126    c[ii] = a[jj];
127
128  // expected-error@+2 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'ii'}}
129  #pragma omp simd
130  for (ii = 0; ii < 10; ++ ++ ii)
131    c[ii] = a[ii];
132
133  // Ok but undefined behavior (in general, cannot check that incr
134  // is really loop-invariant).
135  #pragma omp simd
136  for (ii = 0; ii < 10; ii = ii + ii)
137    c[ii] = a[ii];
138
139  // expected-error@+2 {{expression must have integral or unscoped enumeration type, not 'float'}}
140  #pragma omp simd
141  for (ii = 0; ii < 10; ii = ii + 1.0f)
142    c[ii] = a[ii];
143
144  // Ok - step was converted to integer type.
145  #pragma omp simd
146  for (ii = 0; ii < 10; ii = ii + (int)1.1f)
147    c[ii] = a[ii];
148
149  // expected-error@+2 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'ii'}}
150  #pragma omp simd
151  for (ii = 0; ii < 10; jj = ii + 2)
152    c[ii] = a[ii];
153
154  // expected-warning@+3 {{relational comparison result unused}}
155  // expected-error@+2 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'ii'}}
156  #pragma omp simd
157  for (ii = 0; ii < 10; jj > kk + 2)
158    c[ii] = a[ii];
159
160  // expected-error@+2 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'ii'}}
161  #pragma omp simd
162  for (ii = 0; ii < 10;)
163    c[ii] = a[ii];
164
165  // expected-warning@+3 {{expression result unused}}
166  // expected-error@+2 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'ii'}}
167  #pragma omp simd
168  for (ii = 0; ii < 10; !ii)
169    c[ii] = a[ii];
170
171  // expected-error@+2 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'ii'}}
172  #pragma omp simd
173  for (ii = 0; ii < 10; ii ? ++ii : ++jj)
174    c[ii] = a[ii];
175
176  // expected-error@+2 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'ii'}}
177  #pragma omp simd
178  for (ii = 0; ii < 10; ii = ii < 10)
179    c[ii] = a[ii];
180
181  // expected-note@+3 {{loop step is expected to be positive due to this condition}}
182  // expected-error@+2 {{increment expression must cause 'ii' to increase on each iteration of OpenMP for loop}}
183  #pragma omp simd
184  for (ii = 0; ii < 10; ii = ii + 0)
185    c[ii] = a[ii];
186
187  // expected-note@+3 {{loop step is expected to be positive due to this condition}}
188  // expected-error@+2 {{increment expression must cause 'ii' to increase on each iteration of OpenMP for loop}}
189  #pragma omp simd
190  for (ii = 0; ii < 10; ii = ii + (int)(0.8 - 0.45))
191    c[ii] = a[ii];
192
193  // expected-note@+3 {{loop step is expected to be positive due to this condition}}
194  // expected-error@+2 {{increment expression must cause 'ii' to increase on each iteration of OpenMP for loop}}
195  #pragma omp simd
196  for (ii = 0; (ii) < 10; ii-=25)
197    c[ii] = a[ii];
198
199  // expected-note@+3 {{loop step is expected to be positive due to this condition}}
200  // expected-error@+2 {{increment expression must cause 'ii' to increase on each iteration of OpenMP for loop}}
201  #pragma omp simd
202  for (ii = 0; (ii < 10); ii-=0)
203    c[ii] = a[ii];
204
205  // expected-note@+3 {{loop step is expected to be negative due to this condition}}
206  // expected-error@+2 {{increment expression must cause 'ii' to decrease on each iteration of OpenMP for loop}}
207  #pragma omp simd
208  for (ii = 0; ii > 10; (ii+=0))
209    c[ii] = a[ii];
210
211  // expected-note@+3 {{loop step is expected to be positive due to this condition}}
212  // expected-error@+2 {{increment expression must cause 'ii' to increase on each iteration of OpenMP for loop}}
213  #pragma omp simd
214  for (ii = 0; ii < 10; (ii) = (1-1)+(ii))
215    c[ii] = a[ii];
216
217  // expected-note@+3 {{loop step is expected to be negative due to this condition}}
218  // expected-error@+2 {{increment expression must cause 'ii' to decrease on each iteration of OpenMP for loop}}
219  #pragma omp simd
220  for ((ii = 0); ii > 10; (ii-=0))
221    c[ii] = a[ii];
222
223  // expected-note@+3 {{loop step is expected to be positive due to this condition}}
224  // expected-error@+2 {{increment expression must cause 'ii' to increase on each iteration of OpenMP for loop}}
225  #pragma omp simd
226  for (ii = 0; (ii < 10); (ii-=0))
227    c[ii] = a[ii];
228
229  // expected-note@+2  {{defined as private}}
230  // expected-error@+2 {{loop iteration variable in the associated loop of 'omp simd' directive may not be private, predetermined as linear}}
231  #pragma omp simd private(ii)
232  for (ii = 0; ii < 10; ii++)
233    c[ii] = a[ii];
234
235  // expected-error@+3 {{unexpected OpenMP clause 'shared' in directive '#pragma omp simd'}}
236  // expected-note@+2  {{defined as shared}}
237  // expected-error@+2 {{loop iteration variable in the associated loop of 'omp simd' directive may not be shared, predetermined as linear}}
238  #pragma omp simd shared(ii)
239  for (ii = 0; ii < 10; ii++)
240    c[ii] = a[ii];
241
242  #pragma omp simd linear(ii)
243  for (ii = 0; ii < 10; ii++)
244    c[ii] = a[ii];
245
246  #pragma omp simd lastprivate(ii) linear(jj) collapse(2) // expected-note {{defined as linear}}
247  for (ii = 0; ii < 10; ii++)
248  for (jj = 0; jj < 10; jj++) // expected-error {{loop iteration variable in the associated loop of 'omp simd' directive may not be linear, predetermined as lastprivate}}
249    c[ii] = a[jj];
250
251
252  #pragma omp parallel
253  {
254    // expected-error@+2 {{loop iteration variable in the associated loop of 'omp simd' directive may not be threadprivate or thread local, predetermined as linear}}
255    #pragma omp simd
256    for (sii = 0; sii < 10; sii+=1)
257      c[sii] = a[sii];
258  }
259
260  // expected-error@+2 {{statement after '#pragma omp simd' must be a for loop}}
261  #pragma omp simd
262  for (auto &item : a) {
263    item = item + 1;
264  }
265
266  // expected-note@+3 {{loop step is expected to be positive due to this condition}}
267  // expected-error@+2 {{increment expression must cause 'i' to increase on each iteration of OpenMP for loop}}
268  #pragma omp simd
269  for (unsigned i = 9; i < 10; i--) {
270    c[i] = a[i] + b[i];
271  }
272
273  int (*lb)[4] = nullptr;
274  #pragma omp simd
275  for (int (*p)[4] = lb; p < lb + 8; ++p) {
276  }
277
278  // expected-warning@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
279  #pragma omp simd
280  for (int a{0}; a<10; ++a) {
281  }
282
283  return 0;
284}
285
286// Iterators allowed in openmp for-loops.
287namespace std {
288struct random_access_iterator_tag { };
289template <class Iter> struct iterator_traits {
290  typedef typename Iter::difference_type difference_type;
291  typedef typename Iter::iterator_category iterator_category;
292};
293template <class Iter>
294typename iterator_traits<Iter>::difference_type
295distance(Iter first, Iter last) { return first - last; }
296}
297class Iter0 {
298  public:
299    Iter0() { }
300    Iter0(const Iter0 &) { }
301    Iter0 operator ++() { return *this; }
302    Iter0 operator --() { return *this; }
303    bool operator <(Iter0 a) { return true; }
304};
305int operator -(Iter0 a, Iter0 b) { return 0; }
306class Iter1 {
307  public:
308    Iter1(float f=0.0f, double d=0.0) { }
309    Iter1(const Iter1 &) { }
310    Iter1 operator ++() { return *this; }
311    Iter1 operator --() { return *this; }
312    bool operator <(Iter1 a) { return true; }
313    bool operator >=(Iter1 a) { return false; }
314};
315class GoodIter {
316  public:
317    GoodIter() { }
318    GoodIter(const GoodIter &) { }
319    GoodIter(int fst, int snd) { }
320    GoodIter &operator =(const GoodIter &that) { return *this; }
321    GoodIter &operator =(const Iter0 &that) { return *this; }
322    GoodIter &operator +=(int x) { return *this; }
323    explicit GoodIter(void *) { }
324    GoodIter operator ++() { return *this; }
325    GoodIter operator --() { return *this; }
326    bool operator !() { return true; }
327    bool operator <(GoodIter a) { return true; }
328    bool operator <=(GoodIter a) { return true; }
329    bool operator >=(GoodIter a) { return false; }
330    typedef int difference_type;
331    typedef std::random_access_iterator_tag iterator_category;
332};
333int operator -(GoodIter a, GoodIter b) { return 0; }
334GoodIter operator -(GoodIter a) { return a; }
335GoodIter operator -(GoodIter a, int v) { return GoodIter(); }
336GoodIter operator +(GoodIter a, int v) { return GoodIter(); }
337GoodIter operator -(int v, GoodIter a) { return GoodIter(); }
338GoodIter operator +(int v, GoodIter a) { return GoodIter(); }
339
340int test_with_random_access_iterator() {
341  GoodIter begin, end;
342  Iter0 begin0, end0;
343  #pragma omp simd
344  for (GoodIter I = begin; I < end; ++I)
345    ++I;
346  // expected-error@+2 {{variable must be of integer or random access iterator type}}
347  #pragma omp simd
348  for (GoodIter &I = begin; I < end; ++I)
349    ++I;
350  #pragma omp simd
351  for (GoodIter I = begin; I >= end; --I)
352    ++I;
353  // expected-warning@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
354  #pragma omp simd
355  for (GoodIter I(begin); I < end; ++I)
356    ++I;
357  // expected-warning@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
358  #pragma omp simd
359  for (GoodIter I(nullptr); I < end; ++I)
360    ++I;
361  // expected-warning@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
362  #pragma omp simd
363  for (GoodIter I(0); I < end; ++I)
364    ++I;
365  // expected-warning@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
366  #pragma omp simd
367  for (GoodIter I(1,2); I < end; ++I)
368    ++I;
369  #pragma omp simd
370  for (begin = GoodIter(0); begin < end; ++begin)
371    ++begin;
372  #pragma omp simd
373  for (begin = begin0; begin < end; ++begin)
374    ++begin;
375  // expected-error@+2 {{initialization clause of OpenMP for loop must be of the form 'var = init' or 'T var = init'}}
376  #pragma omp simd
377  for (++begin; begin < end; ++begin)
378    ++begin;
379  #pragma omp simd
380  for (begin = end; begin < end; ++begin)
381    ++begin;
382  // expected-error@+2 {{condition of OpenMP for loop must be a relational comparison ('<', '<=', '>', or '>=') of loop variable 'I'}}
383  #pragma omp simd
384  for (GoodIter I = begin; I - I; ++I)
385    ++I;
386  // expected-error@+2 {{condition of OpenMP for loop must be a relational comparison ('<', '<=', '>', or '>=') of loop variable 'I'}}
387  #pragma omp simd
388  for (GoodIter I = begin; begin < end; ++I)
389    ++I;
390  // expected-error@+2 {{condition of OpenMP for loop must be a relational comparison ('<', '<=', '>', or '>=') of loop variable 'I'}}
391  #pragma omp simd
392  for (GoodIter I = begin; !I; ++I)
393    ++I;
394  // expected-note@+3 {{loop step is expected to be negative due to this condition}}
395  // expected-error@+2 {{increment expression must cause 'I' to decrease on each iteration of OpenMP for loop}}
396  #pragma omp simd
397  for (GoodIter I = begin; I >= end; I = I + 1)
398    ++I;
399  #pragma omp simd
400  for (GoodIter I = begin; I >= end; I = I - 1)
401    ++I;
402  // expected-error@+2 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'I'}}
403  #pragma omp simd
404  for (GoodIter I = begin; I >= end; I = -I)
405    ++I;
406  // expected-note@+3 {{loop step is expected to be negative due to this condition}}
407  // expected-error@+2 {{increment expression must cause 'I' to decrease on each iteration of OpenMP for loop}}
408  #pragma omp simd
409  for (GoodIter I = begin; I >= end; I = 2 + I)
410    ++I;
411  // expected-error@+2 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'I'}}
412  #pragma omp simd
413  for (GoodIter I = begin; I >= end; I = 2 - I)
414    ++I;
415  #pragma omp simd
416  for (Iter0 I = begin0; I < end0; ++I)
417    ++I;
418  // Initializer is constructor without params.
419  // expected-warning@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
420  #pragma omp simd
421  for (Iter0 I; I < end0; ++I)
422    ++I;
423  Iter1 begin1, end1;
424  #pragma omp simd
425  for (Iter1 I = begin1; I < end1; ++I)
426    ++I;
427  // expected-note@+3 {{loop step is expected to be negative due to this condition}}
428  // expected-error@+2 {{increment expression must cause 'I' to decrease on each iteration of OpenMP for loop}}
429  #pragma omp simd
430  for (Iter1 I = begin1; I >= end1; ++I)
431    ++I;
432  // Initializer is constructor with all default params.
433  // expected-warning@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
434  #pragma omp simd
435  for (Iter1 I; I < end1; ++I) {
436  }
437  return 0;
438}
439
440template <typename IT, int ST> class TC {
441  public:
442    int dotest_lt(IT begin, IT end) {
443      // expected-note@+3 {{loop step is expected to be positive due to this condition}}
444      // expected-error@+2 {{increment expression must cause 'I' to increase on each iteration of OpenMP for loop}}
445      #pragma omp simd
446      for (IT I = begin; I < end; I = I + ST) {
447        ++I;
448      }
449      // expected-note@+3 {{loop step is expected to be positive due to this condition}}
450      // expected-error@+2 {{increment expression must cause 'I' to increase on each iteration of OpenMP for loop}}
451      #pragma omp simd
452      for (IT I = begin; I <= end; I += ST) {
453        ++I;
454      }
455      #pragma omp simd
456      for (IT I = begin; I < end; ++I) {
457        ++I;
458      }
459    }
460
461    static IT step() {
462      return IT(ST);
463    }
464};
465template <typename IT, int ST=0> int dotest_gt(IT begin, IT end) {
466  // expected-note@+3 2 {{loop step is expected to be negative due to this condition}}
467  // expected-error@+2 2 {{increment expression must cause 'I' to decrease on each iteration of OpenMP for loop}}
468  #pragma omp simd
469  for (IT I = begin; I >= end; I = I + ST) {
470    ++I;
471  }
472  // expected-note@+3 2 {{loop step is expected to be negative due to this condition}}
473  // expected-error@+2 2 {{increment expression must cause 'I' to decrease on each iteration of OpenMP for loop}}
474  #pragma omp simd
475  for (IT I = begin; I >= end; I += ST) {
476    ++I;
477  }
478
479  // expected-note@+3 {{loop step is expected to be negative due to this condition}}
480  // expected-error@+2 {{increment expression must cause 'I' to decrease on each iteration of OpenMP for loop}}
481  #pragma omp simd
482  for (IT I = begin; I >= end; ++I) {
483    ++I;
484  }
485
486  #pragma omp simd
487  for (IT I = begin; I < end; I+=TC<int,ST>::step()) {
488    ++I;
489  }
490}
491
492void test_with_template() {
493  GoodIter begin, end;
494  TC<GoodIter, 100> t1;
495  TC<GoodIter, -100> t2;
496  t1.dotest_lt(begin, end);
497  t2.dotest_lt(begin, end); // expected-note {{in instantiation of member function 'TC<GoodIter, -100>::dotest_lt' requested here}}
498  dotest_gt(begin, end); // expected-note {{in instantiation of function template specialization 'dotest_gt<GoodIter, 0>' requested here}}
499  dotest_gt<unsigned, -10>(0, 100); // expected-note {{in instantiation of function template specialization 'dotest_gt<unsigned int, -10>' requested here}}
500}
501
502void test_loop_break() {
503  const int N = 100;
504  float a[N], b[N], c[N];
505  #pragma omp simd
506  for (int i = 0; i < 10; i++) {
507    c[i] = a[i] + b[i];
508    for (int j = 0; j < 10; ++j) {
509      if (a[i] > b[j])
510        break; // OK in nested loop
511    }
512    switch(i) {
513      case 1:
514        b[i]++;
515        break;
516      default:
517        break;
518    }
519    if (c[i] > 10)
520      break; // expected-error {{'break' statement cannot be used in OpenMP for loop}}
521
522    if (c[i] > 11)
523      break; // expected-error {{'break' statement cannot be used in OpenMP for loop}}
524  }
525
526  #pragma omp simd
527  for (int i = 0; i < 10; i++) {
528    for (int j = 0; j < 10; j++) {
529      c[i] = a[i] + b[i];
530      if (c[i] > 10) {
531        if (c[i] < 20) {
532          break; // OK
533        }
534      }
535    }
536  }
537}
538
539void test_loop_eh() {
540  const int N = 100;
541  float a[N], b[N], c[N];
542  #pragma omp simd
543  for (int i = 0; i < 10; i++) {
544    c[i] = a[i] + b[i];
545    try { // expected-error {{'try' statement cannot be used in OpenMP simd region}}
546      for (int j = 0; j < 10; ++j) {
547        if (a[i] > b[j])
548          throw a[i]; // expected-error {{'throw' statement cannot be used in OpenMP simd region}}
549      }
550      throw a[i]; // expected-error {{'throw' statement cannot be used in OpenMP simd region}}
551    }
552    catch (float f) {
553      if (f > 0.1)
554        throw a[i]; // expected-error {{'throw' statement cannot be used in OpenMP simd region}}
555      return; // expected-error {{cannot return from OpenMP region}}
556    }
557    switch(i) {
558      case 1:
559        b[i]++;
560        break;
561      default:
562        break;
563    }
564    for (int j = 0; j < 10; j++) {
565      if (c[i] > 10)
566        throw c[i]; // expected-error {{'throw' statement cannot be used in OpenMP simd region}}
567    }
568  }
569  if (c[9] > 10)
570    throw c[9]; // OK
571
572  #pragma omp simd
573  for (int i = 0; i < 10; ++i) {
574    struct S {
575      void g() { throw 0; }
576    };
577  }
578}
579
580