aboutsummaryrefslogtreecommitdiff
path: root/src/check_decl.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2025-04-03 10:55:35 +0100
committergingerBill <bill@gingerbill.org>2025-04-03 10:55:35 +0100
commitd9f990d42e2a1bccf3e7be8ba02efa6504e9af9b (patch)
tree557c5342790be0057fa01a7a3192479f5f9b410b /src/check_decl.cpp
parent511c18629749de61e3755152a440ed80cd46ed1e (diff)
Fix #4975dev-2025-04
Diffstat (limited to 'src/check_decl.cpp')
-rw-r--r--src/check_decl.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/check_decl.cpp b/src/check_decl.cpp
index 5607ea725..250e8b854 100644
--- a/src/check_decl.cpp
+++ b/src/check_decl.cpp
@@ -628,6 +628,10 @@ gb_internal void check_const_decl(CheckerContext *ctx, Entity *e, Ast *type_expr
Operand x = {};
x.type = entity->type;
x.mode = Addressing_Variable;
+ if (entity->kind == Entity_Constant) {
+ x.mode = Addressing_Constant;
+ x.value = entity->Constant.value;
+ }
if (!check_is_assignable_to(ctx, &x, e->type)) {
gbString expr_str = expr_to_string(init);
gbString op_type_str = type_to_string(entity->type);