1f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -verify %s 2f4a2713aSLionel Sambuc 3f4a2713aSLionel Sambuc // PR10034 4f4a2713aSLionel Sambuc struct X {}; 5f4a2713aSLionel Sambuc exx(X)6f4a2713aSLionel Sambucvoid exx(X) {} 7f4a2713aSLionel Sambuc test_ptr10034(int argc,char ** argv)8f4a2713aSLionel Sambucint test_ptr10034(int argc, char **argv) 9f4a2713aSLionel Sambuc { 10f4a2713aSLionel Sambuc if (argc > 3) 11f4a2713aSLionel Sambuc goto end; 12f4a2713aSLionel Sambuc 13f4a2713aSLionel Sambuc X x; 14f4a2713aSLionel Sambuc X xs[16]; 15f4a2713aSLionel Sambuc exx(x); 16f4a2713aSLionel Sambuc 17f4a2713aSLionel Sambuc end: 18f4a2713aSLionel Sambuc if (argc > 1) { 19f4a2713aSLionel Sambuc for (int i = 0; i < argc; ++i) 20f4a2713aSLionel Sambuc { 21f4a2713aSLionel Sambuc 22f4a2713aSLionel Sambuc } 23f4a2713aSLionel Sambuc } 24f4a2713aSLionel Sambuc return 0; 25f4a2713aSLionel Sambuc } 26f4a2713aSLionel Sambuc 27f4a2713aSLionel Sambuc struct Y { 28f4a2713aSLionel Sambuc ~Y(); 29f4a2713aSLionel Sambuc }; 30f4a2713aSLionel Sambuc test_Y()31f4a2713aSLionel Sambucvoid test_Y() { 32*0a6a1f1dSLionel Sambuc goto end; // expected-error{{cannot jump from this goto statement to its label}} 33f4a2713aSLionel Sambuc Y y; // expected-note{{jump bypasses variable with a non-trivial destructor}} 34f4a2713aSLionel Sambuc end: 35f4a2713aSLionel Sambuc return; 36f4a2713aSLionel Sambuc } 37f4a2713aSLionel Sambuc 38f4a2713aSLionel Sambuc struct Z { 39f4a2713aSLionel Sambuc Z operator=(const Z&); 40f4a2713aSLionel Sambuc }; 41f4a2713aSLionel Sambuc test_Z()42f4a2713aSLionel Sambucvoid test_Z() { 43*0a6a1f1dSLionel Sambuc goto end; // expected-error{{cannot jump from this goto statement to its label}} 44f4a2713aSLionel Sambuc Z z; // expected-note{{jump bypasses initialization of non-POD variable}} 45f4a2713aSLionel Sambuc end: 46f4a2713aSLionel Sambuc return; 47f4a2713aSLionel Sambuc } 48