Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • tests/exceptions/polymorphic.cfa

    r3bf9d10 rd00d581  
    11// Testing polymophic exception types.
    2 
    3 #include <fstream.hfa>
    42
    53forall(T &) exception proxy {};
     
    1513                throw an_int;
    1614        } catch (proxy(int) *) {
    17                 sout | "terminate catch";
     15                printf("terminate catch\n");
    1816        }
    1917
     
    2119                throwResume a_char;
    2220        } catchResume (proxy(char) *) {
    23                 sout | "resume catch";
     21                printf("resume catch\n");
    2422        }
    2523
     
    2725                throw a_char;
    2826        } catch (proxy(int) *) {
    29                 sout | "caught proxy(int)";
     27                printf("caught proxy(int)\n");
    3028        } catch (proxy(char) *) {
    31                 sout | "caught proxy(char)";
     29                printf("caught proxy(char)\n");
    3230        }
    3331}
     
    4644                throw except;
    4745        } catch (cell(int) * error) {
    48                 sout | error->data;
     46                printf("%d\n", error->data);
    4947        }
    5048
     
    5250                cell(bool) ball = {&bool_cell, false};
    5351                throwResume ball;
    54                 sout | ball.data;
     52                printf("%i\n", ball.data);
    5553        } catchResume (cell(bool) * error) {
    56                 sout | error->data;
     54                printf("%i\n", error->data);
    5755                error->data = true;
    5856        }
     
    6159int main(int argc, char * argv[]) {
    6260        proxy_test();
    63         sout | nl;
     61        printf("\n");
    6462        cell_test();
    6563}
Note: See TracChangeset for help on using the changeset viewer.