v
v copied to clipboard
checker: specific array initialisation fails
OS: macos, macOS, 12.3.1, 21E258
Processor: 8 cpus, 64bit, little endian, Apple M1
CC version: Apple clang version 13.1.6 (clang-1316.0.21.2)
getwd: /Users/hunam/Documents/dev/go2v
vmodules: /Users/hunam/.vmodules
vroot: /Applications/v
vexe: /Applications/v/v
vexe mtime: 2022-05-02 17:47:15
is vroot writable: true
is vmodules writable: true
V full version: V 0.2.4 8cc79e4.990afe3
Git version: git version 2.32.0 (Apple Git-132)
Git vroot status: weekly.2022.16-125-g990afe37
.git/config present: true
thirdparty/tcc status: thirdparty-unknown-unknown de82a130
What did you do?
fn main() {
arr := []int{len: 2, init: [4][it] or { 0 }}
}
What did you expect to see?
arr equals [4, 0]
What did you see instead?
a.v:2:33: error: non-constant array bound `it`
1 | fn main() {
2 | arr := []int{len: 2, init: [4][it] or { 0 }}
| ~~
3 | }
(the first three mentions are mistakes on my part)
currently
bug.v:2:42: error: unexpected number `0`, expecting name
1 | fn main() {
2 | arr := []int{len: 2, init: [4][it] or { 0 }}
| ^
3 | }