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

Bad codegen for varargs of polymorphic type #9845

Closed
jwollen opened this issue Dec 3, 2018 · 0 comments
Closed

Bad codegen for varargs of polymorphic type #9845

jwollen opened this issue Dec 3, 2018 · 0 comments

Comments

@jwollen
Copy link
Contributor

jwollen commented Dec 3, 2018

The following generates bad C++ code. The varargs-array seems to get resolved to Derived instead of Base. Calling test(x.Base) works as expected.

type
  Base = ref object of RootObj
  Derived = ref object of Base

proc test(x: varargs[Base]) = discard

let x = Derived()

test(x)
LemonBoy added a commit to LemonBoy/Nim that referenced this issue Jan 21, 2019
The type matching is done on the `T` of the `varargs[T]` so the
conversion must be performed to `T` and not to the whole type.

This problem is only noticeable with the cpp backend since C doesn't
give a damn shit about your fucking (wrong) types.

Fixes nim-lang#9845
narimiran pushed a commit that referenced this issue Jan 21, 2019
The type matching is done on the `T` of the `varargs[T]` so the
conversion must be performed to `T` and not to the whole type.

This problem is only noticeable with the cpp backend since C doesn't
give a damn shit about your fucking (wrong) types.

Fixes #9845
ThomasTJdev pushed a commit to ThomasTJdev/Nim that referenced this issue Jan 27, 2019
The type matching is done on the `T` of the `varargs[T]` so the
conversion must be performed to `T` and not to the whole type.

This problem is only noticeable with the cpp backend since C doesn't
give a damn shit about your fucking (wrong) types.

Fixes nim-lang#9845
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant