source: tests/exceptions/trash.cfa @ 6528d75

ADTarm-ehast-experimentalenumforall-pointer-decayjacob/cs343-translationnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change on this file since 6528d75 was ecfd758, checked in by Andrew Beach <ajbeach@…>, 4 years ago

Major exception update, seperating type-ids from virtual tables. The major interface changes are done. There is a regression of ?Cancelled(T) to Some?Cancelled. There is some bits of code for the new verion of the ?Cancelled(T) interface already there. Not connected yet but I just reached the limit of what I wanted to do in one commit and then spent over a day cleaning up, so it will replace Some?Cancelled in a future commit.

  • Property mode set to 100644
File size: 538 bytes
Line 
1// Make sure throw-catch during unwind does not trash internal data.
2
3#include <exception.hfa>
4
5EHM_EXCEPTION(yin)();
6EHM_EXCEPTION(yang)();
7
8EHM_VIRTUAL_TABLE(yin, yin_vt);
9EHM_VIRTUAL_TABLE(yang, yang_vt);
10
11int main(int argc, char * argv[]) {
12        try {
13                try {
14                        throw (yin){&yin_vt};
15                } finally {
16                        try {
17                                throw (yang){&yang_vt};
18                        } catch (yin *) {
19                                printf("inner yin\n");
20                        } catch (yang *) {
21                                printf("inner yang\n");
22                        }
23                }
24        } catch (yin *) {
25                printf("outer yin\n");
26        } catch (yang *) {
27                printf("outer yang\n");
28        }
29}
Note: See TracBrowser for help on using the repository browser.