Support partial const enums despite use-old-enums enabled.

This commit is contained in:
Christoffer Lerno
2025-08-04 17:06:17 +02:00
parent c99284103d
commit 90990ed2f3
3 changed files with 1 additions and 7 deletions

View File

@@ -2592,11 +2592,6 @@ static inline Decl *parse_enum_declaration(ParseContext *c)
if (try_consume(c, TOKEN_COLON))
{
is_const_enum = try_consume(c, TOKEN_CONST);
if (is_const_enum && compiler.build.old_enums)
{
PRINT_ERROR_LAST("'const' enums are not available with '--use-old-enums'.");
return poisoned_decl;
}
if (!tok_is(c, TOKEN_LPAREN) && !tok_is(c, TOKEN_LBRACE))
{
val_is_inline = try_consume(c, TOKEN_INLINE);

View File

@@ -1539,7 +1539,6 @@ static bool rule_enum_to_value(CastContext *cc, bool is_explicit, bool is_silent
{
if (!enum_decl->is_substruct)
{
return sema_cast_error(cc, false, is_silent);
}

View File

@@ -5704,7 +5704,7 @@ static bool sema_expr_rewrite_to_type_property(SemaContext *context, Expr *expr,
.property = property };
return true;
}
goto TYPE_CALL;;
goto TYPE_CALL;
case TYPE_PROPERTY_LOOKUP:
if (!compiler.build.old_enums)
{