Fix assertion failure for JSON_DIAGNOSTICS (#3037)

* Fix assertion failure #3032
This commit is contained in:
Carl Smedstad
2021-10-07 12:24:09 +02:00
committed by GitHub
parent ea528bbfda
commit 62f2997b79
3 changed files with 45 additions and 8 deletions

View File

@@ -234,4 +234,21 @@ TEST_CASE("Better diagnostics")
root.push_back(lower);
}
}
SECTION("Regression test for https://github.com/nlohmann/json/issues/3032")
{
// reference operator[](size_type idx)
{
json j_arr = json::array();
j_arr[0] = 0;
j_arr[1] = 1;
j_arr[2] = 2;
j_arr[3] = 3;
j_arr[4] = 4;
j_arr[5] = 5;
j_arr[6] = 6;
j_arr[7] = 7;
json j_arr_copy = j_arr;
}
}
}