• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
2 
3 // PR10034
4 struct X {};
5 
exx(X)6 void exx(X) {}
7 
test_ptr10034(int argc,char ** argv)8 int 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 
27 struct Y {
28   ~Y();
29 };
30 
31 void f();
test_Y()32 void test_Y() {
33   goto end; // expected-error{{cannot jump from this goto statement to its label}}
34   Y y; // expected-note{{jump bypasses variable with a non-trivial destructor}}
35  end:
36   f();
37   goto inner; // expected-error{{cannot jump from this goto statement to its label}}
38   {
39     Y y2; // expected-note{{jump bypasses variable with a non-trivial destructor}}
40   inner:
41     f();
42   }
43   return;
44 }
45 
46 struct Z {
47   Z operator=(const Z&);
48 };
49 
test_Z()50 void test_Z() {
51   goto end;
52   Z z;
53  end:
54   return;
55 }
56