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

generic methods of the embedded interface causes C error #20113

Closed
shove70 opened this issue Dec 7, 2023 · 0 comments · Fixed by #20124
Closed

generic methods of the embedded interface causes C error #20113

shove70 opened this issue Dec 7, 2023 · 0 comments · Fixed by #20124
Assignees
Labels
Bug This tag is applied to issues which reports bugs.

Comments

@shove70
Copy link
Contributor

shove70 commented Dec 7, 2023

Describe the bug

interface IFoo[T] {
	method (arg T) T
}

interface IBar[T] {
	IFoo[T]
}

struct Derived[T] {
}

fn (d Derived[T]) method[T](arg T) T {
	return arg
}

fn main() {
	a := IBar[int](Derived[int]{})
	_ = a.method(1)
}

Reproduction Steps

/tmp/v_501/a.11806080477544437815.tmp.c:12682:2: error: call to undeclared function 'main__IBar_T_int_method'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
        main__IBar_T_int_method(a, 1);
        ^
1 error generated.
...
==================
(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 using `v bug file.v`.

https://github.com/vlang/v/issues/new/choose

You can also use #help on Discord: https://discord.gg/vlang

Expected Behavior

no errors.

Current Behavior

C error.

Possible Solution

No response

Additional Information/Context

No response

V version

master

Environment details (OS name and version, etc.)

all

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.

@shove70 shove70 added the Bug This tag is applied to issues which reports bugs. label Dec 7, 2023
@shove70 shove70 self-assigned this Dec 7, 2023
shove70 added a commit to shove70/v that referenced this issue Dec 8, 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