From 96127d4ff3027af86da2f9ec0868331d13858684 Mon Sep 17 00:00:00 2001 From: Christian Brendlin <92454917+chrischtel@users.noreply.github.com> Date: Mon, 18 Aug 2025 22:49:42 +0200 Subject: [PATCH] Fix crash when exporting functions with const enums #2384 (#2414) * headers: handle const enums in exported signatures as base type * update releasenotes.md --------- Co-authored-by: Christoffer Lerno --- releasenotes.md | 1 + src/compiler/headers.c | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/releasenotes.md b/releasenotes.md index c9df689a4..4d3af0a18 100644 --- a/releasenotes.md +++ b/releasenotes.md @@ -48,6 +48,7 @@ - Occasionally when using macro method extensions on built-in types, the liveness checker would try to process them. #2398 - Miscompilation of do-while when the while starts with a branch #2394. - Compiler assert when calling unassigned CT functions #2418. +- Fixed crash in header generation when exporting functions with const enums (#2384). ### Stdlib changes - Add `==` to `Pair`, `Triple` and TzDateTime. Add print to `Pair` and `Triple`. diff --git a/src/compiler/headers.c b/src/compiler/headers.c index 0ea399c8f..bd63e15d8 100644 --- a/src/compiler/headers.c +++ b/src/compiler/headers.c @@ -553,7 +553,9 @@ RETRY: header_gen_enum(c, 0, type->decl); return; case TYPE_CONST_ENUM: - TODO; + // TODO; + type = type_flatten(type); + goto RETRY; case TYPE_FUNC_RAW: UNREACHABLE case TYPE_STRUCT: