diff options
| author | gingerBill <bill@gingerbill.org> | 2021-10-09 19:11:10 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2021-10-09 19:11:10 +0100 |
| commit | 2a8d4c5bf575bc11ef9c1cbc8f10992e2e0bd0c0 (patch) | |
| tree | 890e7726edb90ce96bc624256d02fa227bdb7fb1 /src/check_expr.cpp | |
| parent | 2b8807eb73d102862b1e0669baa5334083d01847 (diff) | |
Disallow `or_return` within `defer`
Diffstat (limited to 'src/check_expr.cpp')
| -rw-r--r-- | src/check_expr.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/check_expr.cpp b/src/check_expr.cpp index fb7a98388..2c44890c2 100644 --- a/src/check_expr.cpp +++ b/src/check_expr.cpp @@ -6890,6 +6890,10 @@ ExprKind check_expr_base_internal(CheckerContext *c, Operand *o, Ast *node, Type if (c->curr_proc_sig == nullptr) { error(node, "'%.*s' can only be used within a procedure", LIT(name)); } + + if (c->in_defer) { + error(rs->token, "'or_return' cannot be used within a defer statement"); + } return Expr_Expr; case_end; |