ref: d36a67129c192ca9092cb9189fca535ed9a63a08
parent: 72fb866e7e74af33ffb9872d3099fafee1725484
author: Ori Bernstein <ori@eigenstate.org>
date: Fri Jan 23 12:05:27 EST 2015
Don't crash on returning expressions that evaluate to void. Void should be a valid type -- it's useful in generics. For example: type set = std.htab(foo, void) should be valid.
--- a/6/simp.c
+++ b/6/simp.c
@@ -1380,8 +1380,11 @@
append(s, v);
} else if (n->expr.nargs && n->expr.args[0]) {
t = s->ret;
- t = set(t, rval(s, args[0], NULL));
- append(s, t);
+ /* void calls return nothing */
+ if (t) {
+ t = set(t, rval(s, args[0], NULL));
+ append(s, t);
+ }
}
/* drain the increment queue before we return */
for (i = 0; i < s->nqueue; i++)