Describe the bug
Can access private field in generic struct
Reproduction Steps
module cont
pub struct Foo [T] {
i int
}
pub struct Bar {
i int
}
fn main ()
{
q := cont.Foo[int ]{i:3 } // no error
w := cont.Bar{i:3 } // error: cannot access private field `i` on `cont.Bar`
}
Expected Behavior
expected error
Current Behavior
no error
Possible Solution
No response
Additional Information/Context
No response
V version
V 0.5.0 37577eb
Environment details (OS name and version, etc.)
V full version
V 0.5.0 37577eb
OS
windows, Microsoft Windows 10 Pro 19045 64-bit
Processor
8 cpus, 64bit, little endian, Intel(R) Core(TM) i7-9700K CPU @ 3.60GHz
Memory
45GB/63.94GB
V executable
C:\PORTABLE\DEVELOP\V\VProject_internal\v\v.exe
V last modified time
2026-01-21 15:55:10
V home dir
OK, value: C:\PORTABLE\DEVELOP\V\VProject_internal\v
VMODULES
OK, value: C:\PORTABLE\DEVELOP\V\VProject_internal_z\u.vmodules
VTMP
OK, value: C:\PORTABLE\DEVELOP\V\VProject_internal_z\t\v_0
Current working dir
OK, value: C:\PORTABLE\DEVELOP\V\VProject\master
Git version
git version 2.50.1.windows.1
V git status
N/A
.git/config present
false
cc version
N/A
gcc version
gcc (MinGW-W64 x86_64-ucrt-posix-seh, built by Brecht Sanders, r4) 15.2.0
clang version
N/A
msvc version
N/A
tcc version
tcc version 0.9.27 (x86_64 Windows)
tcc git status
N/A
emcc version
N/A
glibc version
N/A
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.
Describe the bug
Can access private field in generic struct
Reproduction Steps
Expected Behavior
expected error
Current Behavior
no error
Possible Solution
No response
Additional Information/Context
No response
V version
V 0.5.0 37577eb
Environment details (OS name and version, etc.)
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.