-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Open
Labels
BugThis tag is applied to issues which reports bugs.This tag is applied to issues which reports bugs.
Description
Describe the bug
The subject.
Reproduction Steps
// foo.v
module foo
struct Foo {
pub:
bar int
}
pub fn new(bar int) Foo {
return Foo{bar}
}// main.v
module main
import foo
fn main() {
f := foo.new(12)
println(f)
println(f.bar)
}Expected Behavior
Compilation error. Since the Foo struct is not public, its fields must not be public either.
Current Behavior
Output:
foo.Foo{
bar: 12
}
12 // access to Foo.bar field
Possible Solution
No response
Additional Information/Context
No response
V version
V 0.5.0 4b19e9e
Environment details (OS name and version, etc.)
| V full version | V 0.5.0 19e79c4.4b19e9e |
|---|---|
| OS | linux, Linux version 6.18.7-arch1-1 (linux@archlinux) (gcc (GCC) 15.2.1 20260103, GNU ld (GNU Binutils) 2.45.1) #1 SMP PREEMPT_DYNAMIC Sat, 24 Jan 2026 00:47:39 +0000 |
| Processor | 16 cpus, 64bit, little endian, 12th Gen Intel(R) Core(TM) i5-1240P |
| Memory | 1GB/15.34GB |
| V executable | /home/ge/.vlang/v |
| V last modified time | 2026-02-18 09:32:04 |
| V home dir | OK, value: /home/ge/.vlang |
| VMODULES | OK, value: /home/ge/.vmodules |
| VTMP | OK, value: /tmp/v_1000 |
| Current working dir | OK, value: /tmp/pubfield |
| Git version | git version 2.53.0 |
| V git status | weekly.2026.03-320-g4b19e9e4 |
| .git/config present | true |
| cc version | cc (GCC) 15.2.1 20260103 |
| gcc version | gcc (GCC) 15.2.1 20260103 |
| clang version | clang version 21.1.6 |
| tcc version | tcc version 0.9.28rc 2025-02-13 HEAD@f8bd136d (x86_64 Linux) |
| tcc git status | thirdparty-linux-amd64 696c1d84 |
| emcc version | N/A |
| glibc version | ldd (GNU libc) 2.42 |
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.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
BugThis tag is applied to issues which reports bugs.This tag is applied to issues which reports bugs.