-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
.value() with optional default value fails to compile #3859
Comments
Looks like this type is failing the @theodelrieu This came from 74b446f Any thoughts? |
According to your answer it seems like it was never intended to work. Therefore we solved it with a lambda for now:
Is there maybe another intended way in the library for this pattern that I overlooked in the documentation? |
PS: Maybe add a get_opt member function that is like get but wraps every type in optional? |
I honestly don't know if it was intended or not. I was just looking at why it wasn't working now. I know we've had various requests for and PRs about better |
Bumping this up. This issue has hit me hard when upgrading the version of this library from 2.x to 3.x in a project I'm trying to resurrect. |
I too ran into this problem and would find it convenient to use |
The issue is still there even after merging #4036. |
Description
We upgraded from 3.10.5 to 3.11.2
Since the Upgrade we can't compile
value()
with optional fallback value anymoreReproduction steps
Try to compile value with
std::optional<std::string>{}
as fallback. Is this still possible at all, was I using a non-supported edge-case before?Expected vs. actual results
Compiles vs not
Minimal code example
Beforehand we said:
This no longer compiles. Even without the assignment and I tried different versions, all fail to compile:
The text was updated successfully, but these errors were encountered: