From 278c7dd751bb968ffbe58d9e57e412a4fb692680 Mon Sep 17 00:00:00 2001 From: mo Date: Wed, 2 Sep 2026 13:01:39 +1200 Subject: [PATCH] Detect and error on chained offset_of expressions. Fixes #5851. This disallows expressions like `offset_of(a.b.c)`. --- src/check_builtin.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/check_builtin.cpp b/src/check_builtin.cpp index 00065b701..b4ab960d6 100644 --- a/src/check_builtin.cpp +++ b/src/check_builtin.cpp @@ -3146,6 +3146,13 @@ gb_internal bool check_builtin_procedure(CheckerContext *c, Operand *operand, As } ast_node(se, SelectorExpr, arg0); + if (unparen_expr(se->expr)->kind == Ast_SelectorExpr) { + gbString x = expr_to_string(arg0); + error(ce->args[0], "Chained expressions are not allowed for '%.*s', got '%s' ", LIT(builtin_name), x); + gb_string_free(x); + return false; + + } Operand x = {}; check_expr(c, &x, se->expr);