C error from a name shadow that uses the same name as a C function in unsafe
Describe the bug
Using a name that shadows a C function results in an error function pointer expected. Using C.stat(path, struct), with struct being called stat 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
module main
import os
fn stat_to_struct(path_s string) {
mut stat := C.stat{}
path := &char(path_s.str)
unsafe {
C.stat(path, &stat)
}
}
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