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 #31 #32

Merged
merged 1 commit into from
Mar 28, 2023
Merged

Fix #31 #32

merged 1 commit into from
Mar 28, 2023

Conversation

weiznich
Copy link
Contributor

Summary

This commit replaces the use of the std::make_tuple function with an explicit call to the c++ tuple constructor. The old version did relay the implementation defined argument evaluation order of function calls. This broke on g++. See for example this question for more details: https://stackoverflow.com/questions/14056000/how-to-avoid-undefined-execution-order-for-the-constructors-when-using-stdmake

Test Plan

I've tested locally that this fixes the reported issue. Otherwise it's hard to test for that as this relays on implementation specified behaviour.

This commit replaces the use of the `std::make_tuple` function with an
explicit call to the c++ tuple constructor. The old version did relay
the implementation defined argument evaluation order of function calls.
This broke on g++. See for example this question for more details: https://stackoverflow.com/questions/14056000/how-to-avoid-undefined-execution-order-for-the-constructors-when-using-stdmake
@@ -610,8 +610,13 @@ struct Deserializable<std::tuple<Types...>> {
template <typename Deserializer>
static std::tuple<Types...> deserialize(Deserializer &deserializer) {
// Visit each of the type components.
return std::make_tuple(
Deserializable<Types>::deserialize(deserializer)...);
// do not use `std::make_tuple` here
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

@ma2bd ma2bd merged commit eeab064 into zefchain:main Mar 28, 2023
@weiznich weiznich deleted the fix/31 branch March 29, 2023 06:36
@weiznich
Copy link
Contributor Author

Thanks for putting out a release containing this fix in such a timely manner ❤️

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.

2 participants