-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Call to unwrapped ?&Fn fails in if guard and iterator loops #25911
Copy link
Copy link
Labels
BugThis tag is applied to issues which reports bugs.This tag is applied to issues which reports bugs.Status: ConfirmedThis bug has been confirmed to be valid by a contributor.This bug has been confirmed to be valid by a contributor.Unit: cgenBugs/feature requests, that are related to the default C generating backend.Bugs/feature requests, that are related to the default C generating backend.
Metadata
Metadata
Assignees
Labels
BugThis tag is applied to issues which reports bugs.This tag is applied to issues which reports bugs.Status: ConfirmedThis bug has been confirmed to be valid by a contributor.This bug has been confirmed to be valid by a contributor.Unit: cgenBugs/feature requests, that are related to the default C generating backend.Bugs/feature requests, that are related to the default C generating backend.
Describe the bug
Calling a function pointer obtained from a
?&Fn(optional pointer to function) generates invalid C code when unwrapped via if guards or iterator loopsfor x in iter.The C generator creates a double pointer
void (**)(void)but attempts a direct callp(), causing a function pointer expected error. But unwrapping viaor { return }works correctly.Reproduction Steps
The if guard version compared to
or { return }version:The iterator fails either:
Expected Behavior
The if guard and iterator versions should compile and run.
Current Behavior
C compilation fails:
error: function pointer expectedPossible Solution
No response
Additional Information/Context
No response
V version
V 0.4.12 ecd0018
Environment details (OS name and version, etc.)
V 0.4.12 ecd0018
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.