1// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
2
3// PR10034
4struct X {};
5
6void exx(X) {}
7
8int test_ptr10034(int argc, char **argv)
9{
10 if (argc > 3)
11   goto end;
12
13 X x;
14 X xs[16];
15 exx(x);
16
17 end:
18   if (argc > 1) {
19   for (int i = 0; i < argc; ++i)
20   {
21
22   }
23   }
24   return 0;
25}
26
27struct Y {
28  ~Y();
29};
30
31void f();
32void test_Y() {
33  goto end; // expected-error{{goto into protected scope}}
34  Y y; // expected-note{{jump bypasses variable with a non-trivial destructor}}
35 end:
36  f();
37  goto inner; // expected-error{{goto into protected scope}}
38  {
39    Y y2; // expected-note{{jump bypasses variable with a non-trivial destructor}}
40  inner:
41    f();
42  }
43  return;
44}
45
46struct Z {
47  Z operator=(const Z&);
48};
49
50void test_Z() {
51  goto end;
52  Z z;
53 end:
54  return;
55}
56