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[] = "SEH0049.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     Counter += 100;
22     break;
23   case 1:
24     try {
25       try {
26         if ((Index1 & 0x1) == 1) {
27           /* set counter to 1 */
28           Counter += 1;
29         }
30       }
31       finally {
32         /* set counter to 3 */
33         Counter += 2;
34 #if defined(_MSC_VER) && !defined(__clang__)
35         break;
36 #endif
37       }
38       endtry
39 #ifndef _MSC_VER
40         break;
41 #endif
42       /* never get here due to break */
43       Counter += 4;
44     }
45     finally {
46       /* set counter to 8 */
47       Counter += 5;
48     }
49     endtry
50     /* never get hre due to break */
51     Counter += 6;
52   }
53 
54   if (Counter != 8) {
55     printf("TEST 49 FAILED. Counter = %d\n\r", Counter);
56     return -1;
57   }
58 
59   return 0;
60 }
61