v icon indicating copy to clipboard operation
v copied to clipboard

voidptr issue

Open solvecodes opened this issue 1 year ago • 1 comments

Describe the bug

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

==================
C:/Users/unknown/AppData/Local/Temp/v_0/codes.13076969407808905737.tmp.c:6788: warning: implicit declaration of function 'tcc_backtrace'
C:/Users/unknown/AppData/Local/Temp/v_0/codes.13076969407808905737.tmp.c:12550: error: cannot convert 'struct string' to 'void *'
...
==================
(Use `v -cg` to print the entire error message)


Expected Behavior

i am not an expert but i guess a memory address maybe

Current Behavior

returning error on strings but if i put a number i would get its memory address

Reproduction Steps

i am not sure what to put here

Possible Solution

fn main(){
	name := voidptr("hello world")

	println(name)
}

Additional Information/Context

C:\Users\unknown>v --version V 0.4.0 815439a

C:\Users\unknown>

V version

V 0.4.0 815439a

Environment details (OS name and version, etc.)

windows 10 pro 64 bit

solvecodes avatar Aug 18 '23 19:08 solvecodes

Related, I think:

struct Item {
    mut:  
        data []u8
}

fn do() (u16, [3]Item) {
    mut arr := [3]Item{}
    return 1, arr
}

fn main() {
    _, b := do()
    println('${b}')
}
==================
/tmp/v_1000/mini.8741078233056156672.tmp.c:12758: error: cannot convert 'struct _v_Array_fixed_main__Item_3' to 'struct main__Item *'
...
==================
(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

russmack avatar Jan 13 '24 07:01 russmack