v/vlib/v/tests/ptr_arithmetic_test.v

17 lines
234 B
V

fn test_ptr_arithmetic(){
v := 4
mut p := &v
unsafe {
p++
p += 2
}
p = p - 1 // not caught yet
// byteptr, voidptr, charptr are handled differently
mut q := byteptr(1)
unsafe {
q -= 2
}
q = q + 1 // not caught yet
}