source: src/tests/except-1.c@ 1131392

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 1131392 was 86d5ba7c, checked in by Andrew Beach <ajbeach@…>, 8 years ago

Added the memory management calls to the exception control flow.

  • Property mode set to 100644
File size: 624 bytes
Line 
1// Draft memory management test. (remember -fexceptions)
2
3#include <stdio.h>
4
5int main()
6{
7 try {
8 throw 3;
9 }
10 catch( 3 ) {
11 printf("First Caught\n");
12 try {
13 throw 4;
14 }
15 catch( 4 ) {
16 printf("Both Caught\n");
17 }
18 }
19 printf("Part A Complete\n");
20
21 try {
22 try {
23 throw 2;
24 }
25 catch( 2 ) {
26 printf("First Catch and rethrow\n");
27 throw;
28 }
29 }
30 catch( 2 ) {
31 printf("Second Catch\n");
32 }
33 printf("Part B Complete\n");
34
35 try {
36 try {
37 throw 5;
38 }
39 catch( 5 ) {
40 printf("Throw before cleanup\n");
41 throw 6;
42 }
43 }
44 catch( 6 ) {
45 printf("Catch after cleanup\n");
46 }
47 printf("Part C Complete\n");
48}
Note: See TracBrowser for help on using the repository browser.