111
|
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 {
|
|
9 ~A () {}
|
|
10 };
|
|
11
|
|
12 bool
|
|
13 check1 (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
|
|
27 check2 (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
|
|
41 check3 (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
|
|
54 check4 (int x)
|
|
55 {
|
|
56 switch (x)
|
|
57 {
|
|
58 case 0:
|
|
59 return false;
|
|
60 default:
|
|
61 foo ();
|
|
62 break;
|
|
63 }
|
|
64 }
|
|
65
|
|
66 bool
|
|
67 check5 (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
|
|
80 check6 (int x)
|
|
81 {
|
|
82 A z;
|
|
83 switch (x)
|
|
84 {
|
|
85 case 0:
|
|
86 return false;
|
|
87 default:
|
|
88 foo ();
|
|
89 }
|
|
90 }
|