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 <stdio.h>
6 int c, d;
7 struct A
8 {
9     int i;
AA10     A () { i = ++c; printf ("A() %d\n", i); }
AA11     A (const A&) { i = ++c; printf ("A(const A&) %d\n", i); }
~AA12     ~A() { printf ("~A() %d\n", i); ++d; }
13 };
14 int
main()15 main ()
16 {
17     try
18     {
19         try
20         {
21             printf ("Throwing 1...\n");
22             throw A();
23         }
24         catch (A)
25         {
26             try
27             {
28                 printf ("Throwing 2...\n");
29                 throw A();
30             }
31             catch (A)
32             {
33                 printf ("Throwing 3...\n");
34                 throw;
35             }
36         }
37     }
38     catch (A)
39     {
40         printf ("Caught.\n");
41     }
42     printf ("c == %d, d == %d\n", c, d);
43     return c != d;
44 }
45