From 6cf57c1eaa8e7148a57c88c545d27de78e5faf43 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Mon, 22 Jun 2026 13:17:43 +0100 Subject: [PATCH] Fix #6863 --- src/check_expr.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/check_expr.cpp b/src/check_expr.cpp index 24ee86810..cd38ff69a 100644 --- a/src/check_expr.cpp +++ b/src/check_expr.cpp @@ -10179,6 +10179,10 @@ gb_internal ExprKind check_or_branch_expr(CheckerContext *c, Operand *o, Ast *no } } + if (c->in_defer) { + error(node, "'%.*s' cannot be used within a 'defer'", LIT(name)); + } + return Expr_Expr; }