diff --git a/releasenotes.md b/releasenotes.md index 69a591aa2..869796465 100644 --- a/releasenotes.md +++ b/releasenotes.md @@ -152,6 +152,7 @@ - Added posix socket functions. ### Fixes +- Fix casts on empty initializers. - Fix to DString reserve - @local declarations in generic modules available by accident. - Fixes missing checks to body arguments. diff --git a/src/compiler/sema_casts.c b/src/compiler/sema_casts.c index e98ed398b..38f89695c 100644 --- a/src/compiler/sema_casts.c +++ b/src/compiler/sema_casts.c @@ -1097,14 +1097,12 @@ static inline bool cast_maybe_string_byte_lit(Expr *expr, Type *to_canonical, Ty */ static void expr_recursively_rewrite_untyped_list(Expr *expr, Expr **list) { + if (!expr_is_const_untyped_list(expr)) return; expr->expr_kind = EXPR_INITIALIZER_LIST; expr->initializer_list = list; expr->resolve_status = RESOLVE_NOT_DONE; FOREACH_BEGIN(Expr *inner, list) - if (expr_is_const_untyped_list(inner)) - { - expr_recursively_rewrite_untyped_list(inner, inner->const_expr.untyped_list); - } + expr_recursively_rewrite_untyped_list(inner, inner->const_expr.untyped_list); FOREACH_END(); } diff --git a/src/version.h b/src/version.h index 725c47f2f..56e5585b6 100644 --- a/src/version.h +++ b/src/version.h @@ -1 +1 @@ -#define COMPILER_VERSION "0.4.594" \ No newline at end of file +#define COMPILER_VERSION "0.4.595" \ No newline at end of file diff --git a/test/test_suite/cast/cast_untyped_list_error.c3 b/test/test_suite/cast/cast_untyped_list_error.c3 new file mode 100644 index 000000000..afcb9153b --- /dev/null +++ b/test/test_suite/cast/cast_untyped_list_error.c3 @@ -0,0 +1,6 @@ +module testing; + +fn void main() +{ + (void){}; // #error: foekfoe +} \ No newline at end of file