-
Notifications
You must be signed in to change notification settings - Fork 37
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
Cannot pass context as inout
parameter
#1170
Comments
As a workaround one can pass the context as a reference: type X = unit(inout ctx: Ctx&) { }; |
rsmmr
added a commit
that referenced
this issue
Aug 11, 2022
This is an attempt at fixing #1170, and maybe further issues, too (potentially even #674, not sure yet). The problem is that `inout` parameters require a LHS value that can be passed by reference, but our C++ code generator currently has no way of telling what type a C++-side expression ends up having; and hence can't turn a RHS into a LHS when needed. This is an attempt at providing that information: `cxx::Expression` now tracks whether it refers to a LHS, and the code generator creates additional temporaries at places where it needs an LHS but only got a RHS. The current state already works to fix #1170, but I haven't checked further for any new problems it may introduce. If this generally works, I'll also need to go through the code generator and make sure all places producing LHSs are indeed marked as such, so that we avoid introducing unnecessary temporaries. Finally, there's some special paths in the code already working around the very same problem by creating LHSs manually in some cases where this has come up in the past. Those could go out now.
rsmmr
added a commit
that referenced
this issue
Aug 18, 2022
* origin/topic/robin/gh-1170-inout: Fix contexts not allowing being passed `inout`.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In spicy-1.3.0 it was possible to pass a context as an
inout
parameter. This allowed users to work around #1059 in a supposedly forward-compatible way. That workaround is broken with spicy-1.4.1.Bisecting Spicy points to 2905477 as the commit where this broke.
The text was updated successfully, but these errors were encountered: