commit 744b73c19ab30c5e361d5e418209cea170061035
parent 3d4352f9e543fac3c654ec284e1b6f9b0f614505
Author: Drew DeVault <sir@cmpwn.com>
Date: Sun, 31 Jan 2021 17:07:54 -0500
check: calling @noreturn functions terminates
Diffstat:
1 file changed, 3 insertions(+), 0 deletions(-)
diff --git a/src/check.c b/src/check.c
@@ -506,6 +506,9 @@ check_expr_call(struct context *ctx,
fntype->storage == TYPE_STORAGE_FUNCTION,
"Cannot call non-function type");
expr->result = fntype->func.result;
+ if (fntype->func.flags & FN_NORETURN) {
+ expr->terminates = true;
+ }
struct call_argument *arg, **next = &expr->call.args;
struct ast_call_argument *aarg = aexpr->call.args;