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

Builder error : cannot convert 'struct main__Hittable' to 'struct main__Hittable *' #19947

Closed
Eliyaan opened this issue Nov 20, 2023 · 3 comments · Fixed by #19966
Closed

Builder error : cannot convert 'struct main__Hittable' to 'struct main__Hittable *' #19947

Eliyaan opened this issue Nov 20, 2023 · 3 comments · Fixed by #19966
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.

Comments

@Eliyaan
Copy link
Contributor

Eliyaan commented Nov 20, 2023

Describe the bug

Builder error.

Reproduction Steps

fn main() {
}

interface Foo {
}

fn thing(src_objects []Foo) {
	other_thing(src_objects[0], src_objects[1])
}

fn other_thing(a &Foo, b &Foo)  {
}

Expected Behavior

I changed the parameters of the other_thing function for Foo to &Foo because it was asking me to use sort with compare (not in the MRE) and then it made this error.

Current Behavior

==================
C:/Users/PACHECON/AppData/Local/Temp/v_0/version_traduite.10377097033975836209.tmp.c:6829: warning: implicit declaration of function 'tcc_backtrace'C:/Users/PACHECON/AppData/Local/Temp/v_0/version_traduite.10377097033975836209.tmp.c:12785: error: cannot convert 'struct main__Foo' to 'struct main__Foo *'
...
==================
(Use `v -cg` to print the entire error message)

builder error:
==================
C error. This should never happen.

Possible Solution

No response

Additional Information/Context

No response

V version

V 0.4.3 b66447c

Environment details (OS name and version, etc.)

V full version: V 0.4.3 536bf21.b66447c
OS: windows, Microsoft Windows 10 Education v19045 64 bits
Processor: 4 cpus, 64bit, little endian,

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.

@Eliyaan Eliyaan added the Bug This tag is applied to issues which reports bugs. label Nov 20, 2023
@thesombady
Copy link
Contributor

Sure that the compiler should understand that, but pass the values to the function by reference and you at least won't get a build error :)

fn main() {
}

interface Foo {
}

fn thing(src_objects []Foo) {
	other_thing(&src_objects[0], &src_objects[1])
}

fn other_thing(a &Foo, b &Foo)  {
}

@Eliyaan
Copy link
Contributor Author

Eliyaan commented Nov 20, 2023

Ahaha thank you xD

@thesombady
Copy link
Contributor

No problems! Glad to help ✌🏻

@felipensp felipensp added the Unit: cgen Bugs/feature requests, that are related to the default C generating backend. label Nov 21, 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. Unit: cgen Bugs/feature requests, that are related to the default C generating backend.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants