// Trac ticket // https://cforall.uwaterloo.ca/trac/ticket/7 #include extern "C" { #include } // (Bug 1 unresolved as of this test.) forall(otype T) struct stack_node; forall(otype T) struct stack_node { stack_node(T) * next; T item; }; forall(otype T) struct stack { stack_node(T) * head; }; trait stack_errors(otype T) { T emptyStackHandler (stack(T) * this); }; forall(otype T | stack_errors(T)) T pop (stack(T) * this) { return (T){}; } int emptyStackHandler (stack(int) * this) { return 0; } int main (int argc, char * argv[]) { stack(int) stackOfInts; pop(&stackOfInts); return 0; }