Skip to content

Fix the double forwarding bug in function fusion#168

Merged
TrentHouliston merged 15 commits intomainfrom
houliston/fix-double-move
Jan 2, 2025
Merged

Fix the double forwarding bug in function fusion#168
TrentHouliston merged 15 commits intomainfrom
houliston/fix-double-move

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