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

Added explicitly defaulted constructor to error class #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

FrankHB
Copy link

@FrankHB FrankHB commented Dec 2, 2019

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. 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.

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.
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