inconsistent type checking for voidptr field in struct initialization vs direct assignment #24139
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.
Unit: Checker
Bugs/feature requests, that are related to the type checker.
Describe the bug
The compiler has inconsistent type checking behavior for
voidptr
fields in structs. When directly assigning a non-pointer value to avoidptr
field, the compiler correctly throws an error. However, the same type check is missing during struct initialization, allowing invalid assignments to pass without error.Reproduction Steps
Expected Behavior
Current Behavior
Possible Solution
v/checker/struct.v
add the following code arround line 836
Additional Information/Context
No response
V version
V 0.4.10 4872e3c
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.
The text was updated successfully, but these errors were encountered: