Skip to content

Regression: no matching literal operator for call to 'operator""_json' #3645

Closed
@nlohmann

Description

@nlohmann

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

Metadata

Metadata

Labels

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions