v icon indicating copy to clipboard operation
v copied to clipboard

Cgen error when using unsafe on fixed array

Open SolarWolf-Code opened this issue 3 years ago • 0 comments

Describe the bug

The code:

fn main(){
    x := [10]int{}
    y := unsafe {x}
    println(y)
}

results in the following error: /tmp/v_1000/main.5363683437166043845.tmp.c:12262: error: '{' expected (got ";")

Expected Behavior

Using unsafe keyword on a fixed array is not implemented but it also should not give a cgen error. @spytheman suggests it should be checker error, or a nop op

Current Behavior

/tmp/v_1000/main.5363683437166043845.tmp.c:12262: error: '{' expected (got ";")

Reproduction Steps

Use unsafe keyword when assigning fixed array to a new variable

Possible Solution

No response

Additional Information/Context

No response

V version

V 0.3.3 d1f57ea

Environment details (OS name and version, etc.)

OS: linux, "Arch Linux" CC version: cc (GCC) 12.2.1 20230201

SolarWolf-Code avatar Mar 14 '23 07:03 SolarWolf-Code