-
-
Notifications
You must be signed in to change notification settings - Fork 7.1k
Open
Labels
confirmedkind: bugsolution: proposed fixa fix for the issue has been proposed and waits for confirmationa fix for the issue has been proposed and waits for confirmation
Description
Description
We upgraded from 3.10.5 to 3.11.2
Since the Upgrade we can't compile value()
with optional fallback value anymore
Reproduction 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:
std::optional<std::string> customer_id;
customer_id = json.value("customer_id", std::optional<std::string>{});
This no longer compiles. Even without the assignment and I tried different versions, all fail to compile:
json.value("customer_id", std::optional<std::string>{});
json.value<std::optional<std::string>>("customer_id", std::optional<std::string>{});
### Error messages
_No response_
### Compiler and operating system
Ubuntu 22.04, Clang 14
### Library version
3.11.2
### Validation
- (haven't tested this) [ ] The bug also occurs if the latest version from the [`develop`](https://github.com/nlohmann/json/tree/develop) branch is used.
- [X] I can successfully [compile and run the unit tests](https://github.com/nlohmann/json#execute-unit-tests). **All passed**
sgrzeszc and ssudnits
Metadata
Metadata
Assignees
Labels
confirmedkind: bugsolution: proposed fixa fix for the issue has been proposed and waits for confirmationa fix for the issue has been proposed and waits for confirmation