1*fe36f081STimo Kreuzer // Copyright (c) Microsoft. All rights reserved.
2*fe36f081STimo Kreuzer // Licensed under the MIT license. See LICENSE file in the project root for
3*fe36f081STimo Kreuzer // full license information.
4*fe36f081STimo Kreuzer 
5*fe36f081STimo Kreuzer #include <windows.h>
6*fe36f081STimo Kreuzer #include "seh.h"
7*fe36f081STimo Kreuzer 
8*fe36f081STimo Kreuzer char test[] = "SEH0017.c";
9*fe36f081STimo Kreuzer 
main()10*fe36f081STimo Kreuzer int main() {
11*fe36f081STimo Kreuzer 
12*fe36f081STimo Kreuzer   LONG Counter;
13*fe36f081STimo Kreuzer 
14*fe36f081STimo Kreuzer   Counter = 0;
15*fe36f081STimo Kreuzer 
16*fe36f081STimo Kreuzer   try {
17*fe36f081STimo Kreuzer     try {
18*fe36f081STimo Kreuzer       /* set counter = 1 */
19*fe36f081STimo Kreuzer       Counter += 1;
20*fe36f081STimo Kreuzer     }
21*fe36f081STimo Kreuzer     finally {
22*fe36f081STimo Kreuzer       /* set counter = 2 */
23*fe36f081STimo Kreuzer       Counter += 1;
24*fe36f081STimo Kreuzer #if defined(_MSC_VER) && !defined(__clang__)
25*fe36f081STimo Kreuzer       goto t12; /* can't jump into a try/finally */
26*fe36f081STimo Kreuzer #endif
27*fe36f081STimo Kreuzer     }
28*fe36f081STimo Kreuzer     endtry
29*fe36f081STimo Kreuzer 
30*fe36f081STimo Kreuzer   t12:
31*fe36f081STimo Kreuzer     ;
32*fe36f081STimo Kreuzer   }
33*fe36f081STimo Kreuzer   finally {
34*fe36f081STimo Kreuzer     /* set counter = 3 */
35*fe36f081STimo Kreuzer     Counter += 1;
36*fe36f081STimo Kreuzer   }
37*fe36f081STimo Kreuzer   endtry
38*fe36f081STimo Kreuzer 
39*fe36f081STimo Kreuzer   if (Counter != 3) {
40*fe36f081STimo Kreuzer     printf("TEST 17 FAILED. Counter = %d\n\r", Counter);
41*fe36f081STimo Kreuzer     return -1;
42*fe36f081STimo Kreuzer   }
43*fe36f081STimo Kreuzer 
44*fe36f081STimo Kreuzer   return 0;
45*fe36f081STimo Kreuzer }
46