Added explicitly defaulted constructor to error class#4
Open
FrankHB wants to merge 1 commit intoPsiphon-Inc:masterfrom
Open
Added explicitly defaulted constructor to error class#4FrankHB wants to merge 1 commit intoPsiphon-Inc:masterfrom
FrankHB wants to merge 1 commit intoPsiphon-Inc:masterfrom
Conversation
Since the first template argument of `expected` can not always meet `is_nothrow_move_constructible` (e.g. `HTTPParams`), class `Error` (used with `expected`) needs to meet `is_nothrow_move_constructible` to prevent [the assignment operator of `expect` being defined as deleted](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p0323r9.html#expected.object.assign). This actually fixes the build failure with updated expected-lite 0.3.0. Note that `Error(Error&&) = default;` could be sufficient as it would be implicit `noexcept`. The explicit `noexcept` should make the intention more explicit.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Since the first template argument of
expectedcan not always meetis_nothrow_move_constructible(e.g.HTTPParams), classError(used withexpected) needs to meetis_nothrow_move_constructibleto prevent the assignment operator ofexpectbeing defined as deleted. This actually fixes the build failure with updated expected-lite 0.3.0.Note that
Error(Error&&) = default;could be sufficient as it would be implicitnoexcept. The explicitnoexceptshould make the intention more explicit.