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

C error when smart casting interface to type #19788

Closed
lv37 opened this issue Nov 6, 2023 · 1 comment · Fixed by #19829
Closed

C error when smart casting interface to type #19788

lv37 opened this issue Nov 6, 2023 · 1 comment · Fixed by #19829
Assignees
Labels
Bug This tag is applied to issues which reports bugs. Unit: cgen Bugs/feature requests, that are related to the default C generating backend. Unit: Type System Bugs/feature requests, that are related to the V types system.

Comments

@lv37
Copy link
Contributor

lv37 commented Nov 6, 2023

Describe the bug

Trying to compile

module main

interface Abc {
	a int
}

struct Xyz {
	a int
}

fn main() {
	d := Abc(Xyz{})
	if d is Xyz {
		println(d)
	}
}

gives

/tmp/v_1002/src.6834607243794453707.tmp.c:12663: error: cannot convert 'struct main__Xyz' to 'void *'

Reproduction Steps

try to compile the above code

Expected Behavior

compile successfully

Current Behavior

/tmp/v_1002/src.6834607243794453707.tmp.c:12663: error: cannot convert 'struct main__Xyz' to 'void *'

Possible Solution

No response

Additional Information/Context

No response

V version

V 0.4.2 bd52a94

Environment details (OS name and version, etc.)

V full version: V 0.4.2 4bc9a8f.bd52a94
OS: linux, Linux version 6.5.9-200.fc38.x86_64 (mockbuild@1cc7d6d790524511abd343182a21832a) (gcc (GCC) 13.2.1 20231011 (Red Hat 13.2.1-4), GNU ld version 2.39-15.fc38) #1 SMP PREEMPT_DYNAMIC Wed Oct 25 20:40:49 UTC 2023
Processor: 4 cpus, 64bit, little endian, Intel(R) Core(TM) i5-4310U CPU @ 2.00GHz

getwd: /home/user/Projects/v-testing/webview
vexe: /home/user/.local/lib/v/v
vexe mtime: 2023-11-06 17:14:03

vroot: OK, value: /home/user/.local/lib/v
VMODULES: OK, value: /home/user/.vmodules
VTMP: OK, value: /tmp/v_1002

Git version: git version 2.41.0
Git vroot status: weekly.2023.44-67-gbd52a94e
.git/config present: true

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

Note

You can use the 👍 reaction to increase the issue's priority for developers.

Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.

@lv37 lv37 added the Bug This tag is applied to issues which reports bugs. label Nov 6, 2023
@ArtemkaKun ArtemkaKun added Unit: Type System Bugs/feature requests, that are related to the V types system. Unit: cgen Bugs/feature requests, that are related to the default C generating backend. labels Nov 6, 2023
@shove70 shove70 self-assigned this Nov 8, 2023
@shove70
Copy link
Contributor

shove70 commented Nov 8, 2023

Wait for the PR of another related problem to merge and then deal with this one

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. Unit: cgen Bugs/feature requests, that are related to the default C generating backend. Unit: Type System Bugs/feature requests, that are related to the V types system.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants