Skip to content

-Wdeprecated-literal-operator identifies minor syntax updates #601

@mtmorgan

Description

@mtmorgan

Describe the bug

From https://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Dialect-Options.html#index-Wdeprecated-literal-operator, the four occurrences of operator "" _json(...) and similar at

jsoncons::json operator "" _json(const char* s, std::size_t n)
{
return jsoncons::json::parse(jsoncons::json::string_view_type(s, n));
}
inline
jsoncons::wjson operator "" _json(const wchar_t* s, std::size_t n)
{
return jsoncons::wjson::parse(jsoncons::wjson::string_view_type(s, n));
}
inline
jsoncons::ojson operator "" _ojson(const char* s, std::size_t n)
{
return jsoncons::ojson::parse(jsoncons::ojson::string_view_type(s, n));
}
inline
jsoncons::wojson operator "" _ojson(const wchar_t* s, std::size_t n)
{
return jsoncons::wojson::parse(jsoncons::wojson::string_view_type(s, n));
}
should be replaced with operator""_json(...).

With clang version 20.1.0-rc3, an example warning is

include/jsoncons/basic_json.hpp:6452:33: warning: identifier '_json' preceded by whitespace in a literal operator declaration is deprecated [-Wdeprecated-literal-operator]
 6452 |     jsoncons::wjson operator "" _json(const wchar_t* s, std::size_t n)
      |                     ~~~~~~~~~~~~^~~~~
      |                     operator""_json

What jsoncons library version?

  • Latest release 1.3.0
  • Other release ______
  • master

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions