-
Notifications
You must be signed in to change notification settings - Fork 36
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
Non-movable non-copyable expected type fails to compile #58
Comments
I can’t see a comment I got a notification about via email, and I am assuming you found what you were missing but just in case this is Github glitching, the Godbolt is C++23 since that’s where std::expected is implemented and I wanted to show that gcc’s official version does seem to work fine in the case I described. |
Yeah, forgot std:: expected wasn't available until C++23. |
@polasek Above commits should solve this issue. Separation of concerns may be improved upon, something I hope to look into later. |
Great @martinmoene , thanks for the quick turnaround! Your fix does seem to address the compilation issue and I haven't seen any other problems. |
Note to self:
Leaving this issue open, for now, for review. |
Based on cppreference, I couldn't see anything that prohibits neither
T
norE
from being required to be movable or copyable. On gcc 13.1 which implementsstd::expected
, storing a type without copy and move works just fine, butnonstd::expected
fails - weirdly when calling.has_value()
.The error from
nonstd::expected
on the same code as the godbolt link above modulo includingnonstd/expected.hpp
and using namespacenonstd
instead ofstd
:This is with
However, I have seen the same error on gcc 11.3 on Linux with
-std=c++20
.Am I missing something that says I can't do this and is gcc just being overly permissive, or is this an issue with the library?
The text was updated successfully, but these errors were encountered: