source: src/tests/except-1.c@ 936e9f4

ADT aaron-thesis arm-eh ast-experimental cleanup-dtors deferred_resn demangler enum forall-pointer-decay jacob/cs343-translation jenkins-sandbox new-ast new-ast-unique-expr new-env no_list persistent-indexer pthread-emulation qualifiedEnum resolv-new with_gc
Last change on this file since 936e9f4 was fcc88a4, checked in by Andrew Beach <ajbeach@…>, 8 years ago

That got the last case in except-2 working.

  • Property mode set to 100644
File size: 1012 bytes
Line 
1// Draft memory management test. (remember -fexceptions)
2// Outdated: The integer constant exceptions need to be replaced with virtual
3// exceptions for the new system.
4
5#include <stdio.h>
6
7int main()
8{
9 try {
10 throw 3;
11 }
12 catch( 3 ) {
13 printf("First Caught\n");
14 try {
15 throw 4;
16 }
17 catch( 4 ) {
18 printf("Both Caught\n");
19 }
20 }
21 printf("Part A Complete\n");
22
23 try {
24 try {
25 throw 2;
26 }
27 catch( 2 ) {
28 printf("First Catch and rethrow\n");
29 throw;
30 }
31 }
32 catch( 2 ) {
33 printf("Second Catch\n");
34 }
35 printf("Part B Complete\n");
36
37 try {
38 try {
39 throw 5;
40 }
41 catch( 5 ) {
42 printf("Throw before cleanup\n");
43 throw 6;
44 }
45 }
46 catch( 6 ) {
47 printf("Catch after cleanup\n");
48 }
49 printf("Part C Complete\n");
50
51 try {
52 try {
53 throw 7;
54 }
55 catch( 7 ) {
56 printf("Caught initial throw.\n");
57 try {
58 throw 8;
59 }
60 catch( 8 ) {
61 printf("Caught intermediate throw.\n");
62 }
63 throw;
64 }
65 }
66 catch( 7 ) {
67 printf("Caught final throw.\n");
68 }
69 printf("Part D Complete\n");
70}
Note: See TracBrowser for help on using the repository browser.