cgen error for using multiplication on a matched value, inside a type match branch, on an interface #18886
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.
V doctor:
What did you do?
v -g -o vdbg cmd/v && vdbg bug.v
What did you expect to see?
a compiled program
What did you see instead?
Note, that using
println('> integer answer: ${2 * *v}')
compiles cleanly.Imho the problem, is somewhat related to the fact that
v
is not properly auto dereferenced inside the match branch - it gives the illusion, that it can be used as a value, but insteadv
is a pointer, but then the checker allowed2 * v
, and then cgen, generated code fornumber * pointer
which of course does not compile.Imho either it should have been auto dereferenced, so that it in essence it should have generated code for
2 * (*v)
, or there should have been a checker error, that required a manual dereferencing, not allowing me to do2 * v
on the V side.The text was updated successfully, but these errors were encountered: