Home | History | Annotate | Download | only in stmt.dcl
      1 // RUN: %clang_cc1 -fsyntax-only -verify %s
      2 
      3 // PR10034
      4 struct X {};
      5 
      6 void exx(X) {}
      7 
      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 test_Y() {
     32   goto end; // expected-error{{goto into protected scope}}
     33   Y y; // expected-note{{jump bypasses variable with a non-trivial destructor}}
     34  end:
     35   return;
     36 }
     37 
     38 struct Z {
     39   Z operator=(const Z&);
     40 };
     41 
     42 void test_Z() {
     43   goto end; // expected-error{{goto into protected scope}}
     44   Z z; // expected-note{{jump bypasses initialization of non-POD variable}}
     45  end:
     46   return;
     47 }
     48