Skip to content

cgen: fix option ptr initialization#18893

Merged
medvednikov merged 4 commits intovlang:masterfrom
felipensp:fix_option_init_ptr
Jul 19, 2023
Merged

cgen: fix option ptr initialization#18893
medvednikov merged 4 commits intovlang:masterfrom
felipensp:fix_option_init_ptr

Conversation

@felipensp
Copy link
Copy Markdown
Member

@felipensp felipensp commented Jul 17, 2023

Fix #18819

🤖 Generated by Copilot at dd6ed71

Fix C code generation for option types with empty structs. Handle empty struct literals and option type struct fields in cgen.v and struct.v.

🤖 Generated by Copilot at dd6ed71

  • Add a special case for empty struct option types (link)
  • Cast option types to base types when using memdup for struct initialization (link)

@felipensp felipensp marked this pull request as ready for review July 19, 2023 15:08
@medvednikov medvednikov merged commit bd3501a into vlang:master Jul 19, 2023
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.

b := &?Abc{} creates a pointer to a heap allocated Option(Abc{}), not to a heap allocated Option(none)

3 participants