Fix "no matching function" with JsonObjectConst::operator[]

Fixes #2019
This commit is contained in:
Benoit Blanchon
2024-01-03 16:30:44 +01:00
parent 9dc43d14f3
commit cc42373367
3 changed files with 16 additions and 2 deletions

View File

@ -252,3 +252,11 @@ TEST_CASE("JsonObject::operator[]") {
REQUIRE(false == obj["hello"]["world"].is<bool>());
}
}
TEST_CASE("JsonObjectConst::operator[]") {
JsonDocument doc;
doc["hello"] = "world";
JsonObjectConst obj = doc.as<JsonObjectConst>();
REQUIRE(obj["hello"] == "world"); // issue #2019
}