-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
C error when passing interface method to struct field #24810
Copy link
Copy link
Closed
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.Status: Has WorkaroundThis issue has workaround.This issue has workaround.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.
Description
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.Status: Has WorkaroundThis issue has workaround.This issue has workaround.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.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Describe the bug
A struct can have a field of type function:
An interface can have a method:
But this causes a C error:
Reproduction Steps
Run the following program:
Expected Behavior
Expected console output:
Current Behavior
Instead, an error occurs, something like the following:
Possible Solution
Workaround by @spytheman :
do_fn: fn [a] () { Doer(a).do() }Additional Information/Context
No response
V version
V 0.4.11 bd465b5
Environment details (OS name and version, etc.)
I ran this on a laptop, but had the same error running on my phone: