Too restrictive compile time checks for @const. Fixes to wasm nolibc in the standard library.

This commit is contained in:
Christoffer Lerno
2024-08-26 13:33:15 +02:00
parent b33cce385c
commit 388578c209
10 changed files with 54 additions and 18 deletions

View File

@@ -3900,6 +3900,7 @@ bool sema_analyse_var_decl(SemaContext *context, Decl *decl, bool local)
if (global_level_var && !expr_is_constant_eval(init_expr, CONSTANT_EVAL_GLOBAL_INIT))
{
SEMA_ERROR(init_expr, "The expression must be a constant value.");
expr_is_constant_eval(init_expr, CONSTANT_EVAL_GLOBAL_INIT);
return decl_poison(decl);
}
if (global_level_var || !type_is_abi_aggregate(init_expr->type)) sema_cast_const(init_expr);