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
Incorrect result when variable self assignment is used #32
Comments
There is some aliasing happening there. a.noalias() = 2*x - y; // a is not used on the right-hand side and thus we can avoid a temporary
a = 2*x - y; // this also works, but a temporary is created to hold 2*x - y before assigning to a
a = 2*a - a; // a is used on the right-hand side, but now a temporary holding the result prevents a from changing in the middle of the evaluation. |
Just submitted a pull request with the fix. It should be merged to the master branch soon. |
I'll close this issue now that a bug fix has been implemented. Thanks a lot for reporting. |
I have noticed the following behaviour when assigning the result of an operation to a variable used in the operation itself:
The text was updated successfully, but these errors were encountered: