Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
1 of 3 tasks
mtmorgan opened this issue Mar 5, 2025 · 1 comment
Closed
1 of 3 tasks

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

mtmorgan opened this issue Mar 5, 2025 · 1 comment

Comments

@mtmorgan
Copy link
Contributor

mtmorgan commented Mar 5, 2025

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
@danielaparker
Copy link
Owner

Fixed in 1.3.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants