• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
2 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s
3 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
4 
5 // PR10034
6 struct X {};
7 
exx(X)8 void exx(X) {}
9 
test_ptr10034(int argc,char ** argv)10 int test_ptr10034(int argc, char **argv)
11 {
12  if (argc > 3)
13    goto end;
14 
15  X x;
16  X xs[16];
17  exx(x);
18 
19  end:
20    if (argc > 1) {
21    for (int i = 0; i < argc; ++i)
22    {
23 
24    }
25    }
26    return 0;
27 }
28 
29 struct Y {
30   ~Y();
31 };
32 
test_Y()33 void test_Y() {
34   goto end; // expected-error{{cannot jump from this goto statement to its label}}
35   Y y; // expected-note{{jump bypasses variable with a non-trivial destructor}}
36  end:
37   return;
38 }
39 
40 struct Z {
41   Z operator=(const Z&);
42 };
43 
test_Z()44 void test_Z() {
45   goto end;
46 #if __cplusplus <= 199711L
47   // expected-error@-2 {{cannot jump from this goto statement to its label}}
48 #endif
49 
50   Z z;
51 #if __cplusplus <= 199711L
52   // expected-note@-2 {{jump bypasses initialization of non-POD variable}}
53 #endif
54 
55  end:
56   return;
57 }
58