From f7659776fc7f75bfa1cb9a0be4d7376ef9fd39ee Mon Sep 17 00:00:00 2001 From: Christoffer Lerno Date: Wed, 7 Dec 2022 11:58:21 +0100 Subject: [PATCH] Fix problem when taking address of method. --- src/compiler/sema_expr.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/compiler/sema_expr.c b/src/compiler/sema_expr.c index 5ea4b802e..ae0349e2f 100644 --- a/src/compiler/sema_expr.c +++ b/src/compiler/sema_expr.c @@ -5193,18 +5193,18 @@ static inline bool sema_expr_analyse_addr(SemaContext *context, Expr *expr) case EXPR_ACCESS: { Expr *parent = inner->access_expr.parent; + if (parent->expr_kind == EXPR_TYPEINFO) break; Expr *parent_copy = expr_copy(parent); parent->expr_kind = EXPR_UNARY; - parent->unary_expr = (ExprUnary) { .expr = parent_copy, .operator = UNARYOP_ADDR }; + parent->unary_expr = (ExprUnary){ .expr = parent_copy, .operator = UNARYOP_ADDR }; if (!sema_analyse_expr_lvalue_fold_const(context, parent)) return false; expr_rewrite_insert_deref(parent); - FALLTHROUGH; + break; } default: - { - if (!sema_analyse_expr_lvalue(context, inner)) return expr_poison(expr); - } + break; } + if (!sema_analyse_expr_lvalue(context, inner)) return expr_poison(expr); // 2. Take the address. const char *error = sema_addr_check_may_take(inner);