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

expected::error() is inconsistently noexcept #2733

Closed
StephanTLavavej opened this issue May 19, 2022 · 2 comments
Closed

expected::error() is inconsistently noexcept #2733

StephanTLavavej opened this issue May 19, 2022 · 2 comments
Labels
LWG issue needed A wording defect that should be submitted to LWG as a new issue resolved Successfully resolved without a commit

Comments

@StephanTLavavej
Copy link
Member

WG21-N4910 [expected.object.general] class definition:

constexpr const E& error() const &;
constexpr E& error() &;
constexpr const E&& error() const &&;
constexpr E&& error() &&;

[expected.object.obs]/12, /14:

constexpr const E& error() const & noexcept;
constexpr E& error() & noexcept;
constexpr E&& error() && noexcept;
constexpr const E&& error() const && noexcept;

This appears to be an editorial issue - if [expected.object.obs] has decided that they should be noexcept regardless of Preconditions, then the class definition should match.


[expected.void.general] class definition:

constexpr const E& error() const &;
constexpr E& error() &;
constexpr const E&& error() const &&;
constexpr E&& error() &&;

[expected.void.obs]/5, /7:

constexpr const E& error() const &;
constexpr E& error() &;
constexpr E&& error() &&;
constexpr const E&& error() const &&;

These consistently omit noexcept, but it makes no sense that the partial specialization would differ from the primary template here. This appears to be worthy of an LWG issue.

I did a quick search and didn't see existing issues covering this.

@StephanTLavavej StephanTLavavej added the LWG issue needed A wording defect that should be submitted to LWG as a new issue label May 19, 2022
@frederick-vs-ja
Copy link
Contributor

This has been fixed editorially (cplusplus/draft#5381).

@StephanTLavavej
Copy link
Member Author

StephanTLavavej commented May 20, 2022

Oh, awesome! I'll go patch the <expected> PR to not mark expected<void, E>::error() as having been strengthened.

@StephanTLavavej StephanTLavavej added the resolved Successfully resolved without a commit label May 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
LWG issue needed A wording defect that should be submitted to LWG as a new issue resolved Successfully resolved without a commit
Projects
None yet
Development

No branches or pull requests

2 participants