Skip to content

transpile: Properly handle address-of static compound literals#1644

Open
Rua wants to merge 3 commits intoimmunant:masterfrom
Rua:static-compound-literal
Open

transpile: Properly handle address-of static compound literals#1644
Rua wants to merge 3 commits intoimmunant:masterfrom
Rua:static-compound-literal

Conversation

@Rua
Copy link
Contributor

@Rua Rua commented Mar 6, 2026

This allows limited use of statements in translations of statics, only if the statements are Stmt::Item. This is then used to solve the original bug, by declaring a fresh static variable to take the address of.

This code doesn't currently account for situations in which the compound literal expression needs to be sectioned off for late initialisation, as that would have complicated the code a fair bit further.

@Rua Rua force-pushed the static-compound-literal branch from dcbe0fa to 8a200eb Compare March 6, 2026 17:49
@Rua Rua marked this pull request as ready for review March 6, 2026 17:51
@Rua Rua force-pushed the static-compound-literal branch 3 times, most recently from bfbf1f0 to 4a06d79 Compare March 6, 2026 18:30
@Rua Rua force-pushed the static-compound-literal branch from 4a06d79 to b768426 Compare March 6, 2026 18:51
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.

Allow WithStmts in static initialisers to contain statements File-scope compound literal translated incorrectly, causing segfault on write

1 participant