1 // PR c++/54046 2 // { dg-do compile } 3 // { dg-options "-O0 -Wall" } 4 5 void foo (void) __attribute__((noreturn)); 6 7 struct A 8 { ~AA9 ~A () {} 10 }; 11 12 bool check1(int x)13check1 (int x) 14 { 15 A z; 16 switch (x) 17 { 18 case 0: 19 return false; 20 default: 21 throw "X"; 22 break; 23 } 24 } 25 26 bool check2(int x)27check2 (int x) 28 { 29 A z; 30 switch (x) 31 { 32 case 0: 33 return false; 34 default: 35 foo (); 36 break; 37 } 38 } 39 40 bool check3(int x)41check3 (int x) 42 { 43 switch (x) 44 { 45 case 0: 46 return false; 47 default: 48 throw "X"; 49 break; 50 } 51 } 52 53 bool check4(int x)54check4 (int x) 55 { 56 switch (x) 57 { 58 case 0: 59 return false; 60 default: 61 foo (); 62 break; 63 } 64 } 65 66 bool check5(int x)67check5 (int x) 68 { 69 A z; 70 switch (x) 71 { 72 case 0: 73 return false; 74 default: 75 throw "X"; 76 } 77 } 78 79 bool check6(int x)80check6 (int x) 81 { 82 A z; 83 switch (x) 84 { 85 case 0: 86 return false; 87 default: 88 foo (); 89 } 90 } 91