Skip to content

clang++-20 now warns about 'preceding whitespace in literal operator declaration deprecated' #261

@eddelbuettel

Description

@eddelbuettel

My rcpptoml package uses toml++ downstream with R, and the maintainers of the R repo test quite proactively. As can be seen here, under Fedora with clang++-20 we now get

Found the following significant warnings:
  ../inst/include/toml++/impl/path.h:793:19: warning: identifier '_tpath' preceded by whitespace in a literal operator declaration is deprecated [-Wdeprecated-literal-operator]
  ../inst/include/toml++/impl/parser.h:348:27: warning: identifier '_toml' preceded by whitespace in a literal operator declaration is deprecated [-Wdeprecated-literal-operator]

which I will of course fix in the package, simply be removing the whitespace. (Just did the same for a package using the date library.) But as it is present in toml++ I thought I should bring it up and offer a simple PR if that is desired.

A recursive search via ag shows (for the current HEAD):

-*- mode: ag; default-directory: "~/git/tomlplusplus/" -*-
Ag started at Thu Mar  6 13:54:20

ag --literal --group --line-number --column --color --color-match 30\;43 --color-path 1\;32 --smart-case --stats -- operator\"\"\  .
File: toml.hpp
3661:8:		path operator"" _tpath(const char* str, size_t len)
9715:16:		parse_result operator"" _toml(const char* str, size_t len)
9724:16:		parse_result operator"" _toml(const char8_t* str, size_t len)

File: tests/tests.hpp
48:18:constexpr size_t operator"" _sz(unsigned long long n) noexcept

File: include/toml++/impl/path.hpp
793:8:		path operator"" _tpath(const char* str, size_t len)

File: include/toml++/impl/parser.hpp
348:16:		parse_result operator"" _toml(const char* str, size_t len)
377:16:		parse_result operator"" _toml(const char8_t* str, size_t len)
7 matches
4 files contained matches
197 files searched
3777949 bytes searched
0.004609 seconds

Ag finished at Thu Mar  6 13:54:20

There is also this, but maybe less imminent as it is only in vendored code:

-*- mode: ag; default-directory: "~/git/tomlplusplus/" -*-
Ag started at Thu Mar  6 13:51:54

ag --literal --group --line-number --column --color --color-match 30\;43 --color-path 1\;32 --smart-case --stats -- operator\ \"\"\  .
File: vendor/json.hpp
23154:23:inline nlohmann::json operator "" _json(const char* s, std::size_t n)
23162:37:inline nlohmann::json::json_pointer operator "" _json_pointer(const char* s, std::size_t n)

File: vendor/catch.hpp
680:20:    constexpr auto operator "" _sr( char const* rawChars, std::size_t size ) noexcept -> StringRef {
685:16:constexpr auto operator "" _catch_sr( char const* rawChars, std::size_t size ) noexcept -> Catch::StringRef {
3180:20:    Detail::Approx operator "" _a(long double val);
3181:20:    Detail::Approx operator "" _a(unsigned long long val);
7923:20:    Detail::Approx operator "" _a(long double val) {
7926:20:    Detail::Approx operator "" _a(unsigned long long val) {
8 matches
2 files contained matches
197 files searched
3777949 bytes searched
0.008375 seconds

Ag finished at Thu Mar  6 13:51:54

Let me know if you want a quick PR for this. Thanks again for toml++ !!

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions