🚑 fix regression from #2181
This commit is contained in:
parent
d019ddfcdb
commit
e3e9ccfc02
4 changed files with 27 additions and 18 deletions
|
|
@ -1945,6 +1945,15 @@ TEST_CASE("regression tests")
|
|||
)
|
||||
);
|
||||
}
|
||||
|
||||
SECTION("PR #2181 - regression bug with lvalue")
|
||||
{
|
||||
// see https://github.com/nlohmann/json/pull/2181#issuecomment-653326060
|
||||
json j{{"x", "test"}};
|
||||
std::string defval = "default value";
|
||||
auto val = j.value("x", defval);
|
||||
auto val2 = j.value("y", defval);
|
||||
}
|
||||
}
|
||||
|
||||
#if not defined(JSON_NOEXCEPTION)
|
||||
|
|
|
|||
|
|
@ -60,9 +60,9 @@ class person_with_private_data
|
|||
class person_without_private_data_1
|
||||
{
|
||||
public:
|
||||
std::string name = "";
|
||||
int age = 0;
|
||||
json metadata = nullptr;
|
||||
std::string name = "";
|
||||
int age = 0;
|
||||
json metadata = nullptr;
|
||||
|
||||
bool operator==(const person_without_private_data_1& rhs) const
|
||||
{
|
||||
|
|
@ -82,9 +82,9 @@ class person_without_private_data_1
|
|||
class person_without_private_data_2
|
||||
{
|
||||
public:
|
||||
std::string name = "";
|
||||
int age = 0;
|
||||
json metadata = nullptr;
|
||||
std::string name = "";
|
||||
int age = 0;
|
||||
json metadata = nullptr;
|
||||
|
||||
bool operator==(const person_without_private_data_2& rhs) const
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue