-
-
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
When using the .at or .value functions on a ordered_json object with a parameter type of json_pointer there is a deprecation warning due to the following functions being called:
template<typename RefStringTypeLhs, typename StringType = typename json_pointer<RefStringTypeLhs>::string_t>
JSON_HEDLEY_DEPRECATED_FOR(3.11.2, operator==(json_pointer, json_pointer))
inline bool operator==(const json_pointer<RefStringTypeLhs>& lhs, const StringType& rhs)
{
return lhs == json_pointer<RefStringTypeLhs>(rhs);
}
template<typename RefStringTypeRhs, typename StringType = typename json_pointer<RefStringTypeRhs>::string_t>
JSON_HEDLEY_DEPRECATED_FOR(3.11.2, operator==(json_pointer, json_pointer))
inline bool operator==(const StringType& lhs, const json_pointer<RefStringTypeRhs>& rhs)
{
return json_pointer<RefStringTypeRhs>(lhs) == rhs;
}
Reproduction steps
The sample code should illustrate the problem.
Expected vs. actual results
.at and .value should ideally not depend on deprecated functions unless they themselves are deprecated.
Minimal code example
using json = nlohmann::ordered_json;
using json_pointer = json::json_pointer;
int main() {
json j = {{"key", "value"}};
json_pointer ptr("/key");
auto value = j.at(ptr); //deprecation warning
return 0;
}
Error messages
warning: 'operator==' is deprecated: Since 3.11.2; use operator==(json_pointer, json_pointer) [-Wdeprecated-declarations]
...
while substituting deduced template arguments into function template 'at' [with KeyType = json_pointer &, $1 = (no value)]
Compiler and operating system
gcc & clang
Library version
3.11.3
Validation
- The bug also occurs if the latest version from the
develop
branch is used. - I can successfully compile and run the unit tests.
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