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

Fix the double forwarding bug in function fusion #168

Merged
merged 15 commits into from
Jan 2, 2025

Conversation

TrentHouliston
Copy link
Member

@TrentHouliston TrentHouliston commented Dec 27, 2024

Function fusion technically runs std::forward on the same arguments multiple times, in theory this could mean that the second time a function gets those arguments they could have been moved away.

This one was interesting as I realised that I wasn't even forwarding the arguments all the way down. At the last level they were left as lvalue. After fixing this issue the actual bug could be fixed so that shared arguments will always be passed through as lvalues, while unique variables will only ever be sent to a single function and thus, forwarding them multiple times is fine as only one function will ever "see" the final value.

@TrentHouliston TrentHouliston marked this pull request as ready for review December 28, 2024 06:41
@TrentHouliston TrentHouliston merged commit 800752b into main Jan 2, 2025
12 of 14 checks passed
@TrentHouliston TrentHouliston deleted the houliston/fix-double-move branch January 2, 2025 00:37
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

Successfully merging this pull request may close these issues.

1 participant