Skip to content

Fix crash when exporting functions with const enums #2384 #2414

Merged
lerno merged 3 commits into
c3lang:masterfrom
chrischtel:issue_2384
Aug 18, 2025
Merged

Fix crash when exporting functions with const enums #2384 #2414
lerno merged 3 commits into
c3lang:masterfrom
chrischtel:issue_2384

Conversation

@chrischtel
Copy link
Copy Markdown
Contributor

Right now if you export a function that takes a const enum,
the compiler crashes with "TODO reached" in header generation.

see #2384
minimal repro.:

enum Foo : const int
{
    A,
}

fn void test(Foo f) @export
{

}

This patch makes header_gen_maybe_generate_type fall back to the enum’s
underlying integer type, so header generation works instead of failing.

It’s ABI-correct since const enums lower to their base type anyway.
This just fixes the crash for now; nicer typedef/constant output could
be added later if wanted.

@lerno lerno merged commit 96127d4 into c3lang:master Aug 18, 2025
7 of 43 checks passed
@lerno
Copy link
Copy Markdown
Collaborator

lerno commented Aug 18, 2025

Yeah, better have it working. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants