c error on unwrap of an option type in a match #21093
Labels
Bug
This tag is applied to issues which reports bugs.
Unit: cgen
Bugs/feature requests, that are related to the default C generating backend.
Unit: Compiler
Bugs/feature requests, that are related to the V compiler in general.
Describe the bug
Unwrapping an option type using an if statement in a sum type match results in a
cannot convert
c error.Reproduction Steps
Expected Behavior
To compile and print
Bar{}
.Current Behavior
results in
error: cannot convert 'struct main__Foo' to 'struct _option_main__Bar'
Possible Solution
No response
Additional Information/Context
No response
V version
V 6b23b1d
Environment details (OS name and version, etc.)
V full version: V 0.4.5 9d7fe51.6b23b1d
OS: linux, "Arch Linux"
Processor: 12 cpus, 64bit, little endian, AMD Ryzen 5 3600X 6-Core Processor
vroot: OK
VMODULES: OK
VTMP: OK, value: /tmp/v_1000
Git version: git version 2.44.0
Git vroot status: 0.4.5-19-g6b23b1dd
.git/config present: true
CC version: cc (GCC) 13.2.1 20230801
thirdparty/tcc status: thirdparty-linux-amd64 12f392c3
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: