v
v copied to clipboard
cgen error for a `shared h Handler` receiver
V doctor:
V full version: V 0.3.3 5b8d6c0.4b7bfa2
OS: linux, Ubuntu 20.04.5 LTS
Processor: 4 cpus, 64bit, little endian, Intel(R) Core(TM) i3-3225 CPU @ 3.30GHz
getwd: /v/vnew/veloce
vexe: /v/vnew/v
vexe mtime: 2023-04-03 11:50:35
vroot: OK, value: /v/vnew
VMODULES: OK, value: /home/delian/.vmodules
VTMP: OK, value: /tmp/v_1000
Git version: git version 2.40.0
Git vroot status: weekly.2023.14-1-g4b7bfa2e-dirty (4 commit(s) behind V master)
.git/config present: true
CC version: cc (Ubuntu 10.3.0-1ubuntu1~20.04) 10.3.0
thirdparty/tcc status: thirdparty-linux-amd64 12f392c3
What did you do?
v -g -o vdbg cmd/v && vdbg veloce.v
type RouteFn = fn (ctx Context) int
enum RouteType {
get
post
delete
}
struct Route {
typ RouteType
addr string
func RouteFn
}
struct Handler {
routes []Route
}
struct Context {}
fn (shared h Handler) multi_route_do(ctx Context) {
for route in h.routes {
route.func(ctx)
}
}
What did you expect to see?
Either a compiled program, or a clear checker error if shared h Handler receivers are not supported.
What did you see instead?
==================
/tmp/v_1000/veloce.10599565999270951612.tmp.c:1245: error: ';' expected (got "sync__RwMutex")
...
==================
(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
Note:
struct Handler {}
fn (shared h Handler) f() { lock h {} }
compiles cleanly, while:
struct Handler {}
fn (shared h Handler) f() {}
have the same cgen error.
Compiles with latest version of V