C error from a name shadow that uses the same name as a C function in unsafe #17831
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: Compiler
Bugs/feature requests, that are related to the V compiler in general.
Describe the bug
Using a name that shadows a C function results in an error
function pointer expected
. UsingC.stat(path, struct)
, withstruct
being calledstat
results in a function pointer expected error.Expected Behavior
In my case of using
C.stat()
, a structure with the fields copied over.Current Behavior
A function pointer expected error, likely due from variable name shadowing and V thinking it's a C function.
Reproduction Steps
Playground Link: https://play.vlang.io/?query=ad21bd2cc9
Possible Solution
No response
Additional Information/Context
No response
V version
V 0.3.3 8c35ee0.cd6cc65
Environment details (OS name and version, etc.)
V full version: V 0.3.3 8c35ee0.cd6cc65
OS: linux, "Gentoo Linux"
Processor: 16 cpus, 64bit, little endian, AMD Ryzen 9 5900HX with Radeon Graphics
vexe: /home/csfore/v/v
vexe mtime: 2023-03-30 20:32:54
vroot: OK, value: /home/csfore/v
VMODULES: OK, value: /home/csfore/.vmodules
VTMP: OK, value: /tmp/v_1000
Git version: git version 2.39.2
Git vroot status: weekly.2023.13-23-gcd6cc65e
.git/config present: true
CC version: cc (Gentoo 12.2.1_p20230121-r1 p10) 12.2.1 20230121
thirdparty/tcc status: thirdparty-linux-amd64 12f392c3
The text was updated successfully, but these errors were encountered: