- File:
-
- 1 edited
-
tests/exceptions/polymorphic.cfa (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tests/exceptions/polymorphic.cfa
r3bf9d10 rd00d581 1 1 // Testing polymophic exception types. 2 3 #include <fstream.hfa>4 2 5 3 forall(T &) exception proxy {}; … … 15 13 throw an_int; 16 14 } catch (proxy(int) *) { 17 sout | "terminate catch";15 printf("terminate catch\n"); 18 16 } 19 17 … … 21 19 throwResume a_char; 22 20 } catchResume (proxy(char) *) { 23 sout | "resume catch";21 printf("resume catch\n"); 24 22 } 25 23 … … 27 25 throw a_char; 28 26 } catch (proxy(int) *) { 29 sout | "caught proxy(int)";27 printf("caught proxy(int)\n"); 30 28 } catch (proxy(char) *) { 31 sout | "caught proxy(char)";29 printf("caught proxy(char)\n"); 32 30 } 33 31 } … … 46 44 throw except; 47 45 } catch (cell(int) * error) { 48 sout | error->data;46 printf("%d\n", error->data); 49 47 } 50 48 … … 52 50 cell(bool) ball = {&bool_cell, false}; 53 51 throwResume ball; 54 sout | ball.data;52 printf("%i\n", ball.data); 55 53 } catchResume (cell(bool) * error) { 56 sout | error->data;54 printf("%i\n", error->data); 57 55 error->data = true; 58 56 } … … 61 59 int main(int argc, char * argv[]) { 62 60 proxy_test(); 63 sout | nl;61 printf("\n"); 64 62 cell_test(); 65 63 }
Note:
See TracChangeset
for help on using the changeset viewer.