From 141a4062e1b6b861baa30d44915c3c58847f07d2 Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Sat, 17 Oct 2026 09:32:34 +0200 Subject: [PATCH] Allow the string literal parameter of scan_literal() for clang-tidy The parameter takes the literal by array reference so that its length is a template parameter; this is the same exemption the C array overloads of to_json() and from_json() have. Signed-off-by: Niels Lohmann --- include/nlohmann/detail/input/lexer.hpp | 2 +- single_include/nlohmann/json.hpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/nlohmann/detail/input/lexer.hpp b/include/nlohmann/detail/input/lexer.hpp index ae159a8bb..8c13cd6d8 100644 --- a/include/nlohmann/detail/input/lexer.hpp +++ b/include/nlohmann/detail/input/lexer.hpp @@ -1862,7 +1862,7 @@ scan_number_done: @param[in] return_type the token type to return on success */ template - JSON_HEDLEY_NEVER_INLINE token_type scan_literal(const char (&rest)[N], token_type return_type) + JSON_HEDLEY_NEVER_INLINE token_type scan_literal(const char (&rest)[N], token_type return_type) // NOLINT(cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays) { constexpr std::size_t length = N - 1; if (scan_literal_bulk(rest, length, std::integral_constant {})) diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index dc0577942..06b0c907a 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -13857,7 +13857,7 @@ scan_number_done: @param[in] return_type the token type to return on success */ template - JSON_HEDLEY_NEVER_INLINE token_type scan_literal(const char (&rest)[N], token_type return_type) + JSON_HEDLEY_NEVER_INLINE token_type scan_literal(const char (&rest)[N], token_type return_type) // NOLINT(cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays) { constexpr std::size_t length = N - 1; if (scan_literal_bulk(rest, length, std::integral_constant {}))