Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using try_push causes a C generation error #19382

Closed
CG-SS opened this issue Sep 19, 2023 · 0 comments · Fixed by #19383
Closed

Using try_push causes a C generation error #19382

CG-SS opened this issue Sep 19, 2023 · 0 comments · Fixed by #19383
Labels
Bug This tag is applied to issues which reports bugs.

Comments

@CG-SS
Copy link

CG-SS commented Sep 19, 2023

Describe the bug

Using try_push on a channel of an interface type causes the C generation to fail.

Reproduction Steps

Try compiling the following code:

module main

interface TestInterface {
	a int
}

struct TestStruct {
	a int
}

fn main() {
	c := chan TestInterface{cap: 1}

	c.try_push(TestInterface(TestStruct{a: 1}))

	m := <- c
	println(m)
}

Expected Behavior

It should print:

TestInterface(TestStruct{
    a: 1
})

Current Behavior

It fails compiling with the following error:

/tmp/v_1000/main.10210340489945412125.tmp.c:18128: error: cannot convert 'struct main__TestInterface' to 'void *'

Possible Solution

No response

Additional Information/Context

No response

V version

V 0.4.1 77219de

Environment details (OS name and version, etc.)

V full version: V 0.4.1 77219de
OS: linux, Linux version 6.4.12-200.fc38.x86_64 (mockbuild@30894952d3244f1ab967aeda9ed417f6) (gcc (GCC) 13.2.1 20230728 (Red Hat 13.2.1-1), GNU ld version 2.39-9.fc38) #1 SMP PREEMPT_DYNAMIC Wed Aug 23 17:46:49 UTC 2023
Processor: 64 cpus, 64bit, little endian, Intel(R) Xeon(R) CPU E5-2682 v4 @ 2.50GHz

getwd: /home/shockwave-1
vexe: /home/shockwave-1/v/v
vexe mtime: 2023-09-18 23:57:39

vroot: OK, value: /home/shockwave-1/v
VMODULES: OK, value: /home/shockwave-1/.vmodules
VTMP: OK, value: /tmp/v_1000

Git version: git version 2.41.0
Git vroot status: weekly.2023.38-5-g77219de1
.git/config present: true

CC version: cc (GCC) 13.2.1 20230728 (Red Hat 13.2.1-1)
thirdparty/tcc status: thirdparty-linux-amd64 12f392c3

Important

You can vote for this issue using the 👍 reaction. More votes increase the issue's priority
for developers.

Take into account that only the 👍 reaction counts as a vote.
Only reactions to the issue itself will be counted as votes, not comments.

@CG-SS CG-SS added the Bug This tag is applied to issues which reports bugs. label Sep 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug This tag is applied to issues which reports bugs.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant