v
v copied to clipboard
Bug in map assignment and access
Describe the bug
module main
struct Instr {
mut:
a int
b int
}
fn main() {
mut map1 := map[string][]&Instr
instr := &Instr{a:1,b:2}
arr := [ instr ]
map1['Hello'] = arr
map1['Hello'][0].a = 2 // error?
println(map1['Hello'][0].a)
}
Expected Behavior
print 2
Current Behavior
$ v run main.v
==================
/tmp/v_1000/main.5661213509702336810.tmp.c:12465: error: ',' expected (got ")")
...
==================
(Use `v -cg` to print the entire error message)
builder error:
==================
C error. This should never happen.
This is a compiler bug, please report it using `v bug file.v`.
https://github.com/vlang/v/issues/new/choose
You can also use #help on Discord: https://discord.gg/vlang
Reproduction Steps
v run main.v
Possible Solution
No response
Additional Information/Context
No response
V version
V 0.3.3 0bd0942
Environment details (OS name and version, etc.)
OS: linux, Kali GNU/Linux Rolling Processor: 8 cpus, 64bit, little endian, 11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz CC version: cc (Debian 12.2.0-14) 12.2.0
getwd: /home/ibuki/vas vmodules: /home/ibuki/.vmodules vroot: /home/ibuki/v vexe: /home/ibuki/v/v vexe mtime: 2023-03-12 23:35:02 is vroot writable: true is vmodules writable: true V full version: V 0.3.3 0bd0942
Git version: git version 2.39.1 Git vroot status: weekly.2023.10-41-g0bd09429 (12 commit(s) behind V master) .git/config present: true thirdparty/tcc status: thirdparty-linux-amd64 12f392c3