Skip to content

Commit d9f990d

Browse files
committed
Fix #4975
1 parent 511c186 commit d9f990d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/check_decl.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -628,6 +628,10 @@ gb_internal void check_const_decl(CheckerContext *ctx, Entity *e, Ast *type_expr
628628
Operand x = {};
629629
x.type = entity->type;
630630
x.mode = Addressing_Variable;
631+
if (entity->kind == Entity_Constant) {
632+
x.mode = Addressing_Constant;
633+
x.value = entity->Constant.value;
634+
}
631635
if (!check_is_assignable_to(ctx, &x, e->type)) {
632636
gbString expr_str = expr_to_string(init);
633637
gbString op_type_str = type_to_string(entity->type);

0 commit comments

Comments
 (0)