cgen: C nested structs do not work #23421
Labels
Bug
This tag is applied to issues which reports bugs.
Status: Confirmed
This bug has been confirmed to be valid by a contributor.
Unit: cgen
Bugs/feature requests, that are related to the default C generating backend.
Describe the bug
C structs that contain other structs directly within them with a variable name are not usable in V.
Reproduction Steps
Create a new v project with the following files:
Expected Behavior
Should compile.
You are not able to set x at all, even during instantiation of the struct, it should be either set to 0 or produce an error that it is unset (once supported).
Current Behavior
The code will compile with the
_ = C.outer{}
line removed but will not when it is present, in that case it will output givenv -cg -show-c-output .
:Possible Solution
No response
Additional Information/Context
Working on my project https://github.com/dy-tea/vompositor, I noticed that nested structs were generating invalid eq functions during cgen. I have not been able to reproduce this issue outside that codebase so far but noticed this issue while attempting to reproduce it.
V version
V 0.4.9 ba9d358
Environment details (OS name and version, etc.)
Note
You can use the 👍 reaction to increase the issue's priority for developers.
Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.
Huly®: V_0.6-21851
The text was updated successfully, but these errors were encountered: