Closed
Description
Description
Code I wrote for #3594 does no longer compile with the latest 3.11.0 release.
The line in question is
json j;
j = R"({ "1": 1, "2": [ 1, 2, 3, 4, 5], "3": "third-value", "4": { "4-1": 1, "4-2": 2 }, "5": true })"_json;
This compiled before, but now fails with
example.cpp:261:107: error: no matching literal operator for call to 'operator""_json' with arguments of types 'const char *' and 'unsigned long', and no matching literal operator template
j = R"({ "1": 1, "2": [ 1, 2, 3, 4, 5], "3": "third-value", "4": { "4-1": 1, "4-2": 2 }, "5": true })"_json;
^
Reproduction steps
Compile
#include <nlohmann/json.hpp>
using json = nlohmann::json;
int main() {
json j;
j = R"({ "1": 1, "2": [ 1, 2, 3, 4, 5], "3": "third-value", "4": { "4-1": 1, "4-2": 2 }, "5": true })"_json;
}
with version 3.11.0.
Expected vs. actual results
Expected: compiles without error.
Actual: Error.
Minimal code example
See above.
Error messages
example.cpp:7:107: error: no matching literal operator for call to 'operator""_json' with arguments of types 'const char *' and 'unsigned long', and no matching literal operator template
j = R"({ "1": 1, "2": [ 1, 2, 3, 4, 5], "3": "third-value", "4": { "4-1": 1, "4-2": 2 }, "5": true })"_json;
^
Compiler and operating system
Apple Clang 13.1.6 (clang-1316.0.21.2.5), macOS 12.4 (21F79)
Library version
3.11.0 release version
Validation
- The bug also occurs if the latest version from the
develop
branch is used. - I can successfully compile and run the unit tests.