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

Newruntime/regression: Bad codegen for inline methods #11636

jwollen opened this issue Jul 2, 2019 · 0 comments


Copy link

commented Jul 2, 2019

The following generates invalid C/C++ when imported from another module (the declaring module compiles fine).

This works without newruntime and worked with newruntime in 0.19.4

# moduleA
type Obj* = ref object of RootObj
method test*(self: Obj) {.base, inline.} =
  var s: seq[int]

# moduleB
import moduleA


error: invalid initialization of non-const reference of type 'tySequence_qwqHTkRvwhrRyENtudHQ7g&' from an rvalue of type 'tySequence_qwqHTkRvwhrRyENtudHQ7g*'

The issue is some strange interaction with seq.add where the version of testin the importing module address-of's s erroneously, when a reference is expected:

add_MIAbjRZGBQlNfywJeCn8AQ((&s), ((NI) 0));

The version in the defining module is correct:

add_MIAbjRZGBQlNfywJeCn8AQ(s, ((NI) 0));

@narimiran narimiran added the Regression label Jul 2, 2019

@Araq Araq closed this in 476b4ff Jul 3, 2019

narimiran added a commit that referenced this issue Jul 8, 2019

fixes #11636
(cherry picked from commit 476b4ff)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
3 participants
You can’t perform that action at this time.