1 // Copyright (c) Microsoft. All rights reserved.
2 // Licensed under the MIT license. See LICENSE file in the project root for
3 // full license information.
4 
5 #include <windows.h>
6 #include "seh.h"
7 
8 char test[] = "SEH0047.c";
9 int perfect;
10 
11 int main() {
12   ULONG Index1;
13   ULONG Index2 = 1;
14   LONG Counter;
15 
16   Counter = 0;
17   Index1 = 1;
18 
19   switch (Index2) {
20   case 0:
21     /* never gets here */
22     Counter += 100;
23     break;
24   case 1:
25     try {
26       try {
27         if ((Index1 & 0x1) == 1) {
28           /* break out of switch stmt. */
29           break;
30         } else {
31           Counter += 1;
32         }
33       }
34       finally {
35         /* set counter to 2 after "break" */
36         Counter += 2;
37       }
38       endtry
39       Counter += 3;
40     }
41     finally {
42       /* set counter to 4 after break in nested try/finally */
43       Counter += 4;
44     }
45     endtry
46     Counter += 5;
47   }
48 
49   if (Counter != 6) {
50     printf("TEST 47 FAILED. Counter = %d\n\r", Counter);
51     return -1;
52   }
53 
54   return 0;
55 }
56