From 84eaa0c3ccdae8187739ae9d60b554246c62f2af Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Fri, 9 Oct 2026 09:46:09 +0200 Subject: [PATCH] Silence MSVC 2015 C4100 in parser::syntax_error for static SAX::parse_error Signed-off-by: Niels Lohmann --- include/nlohmann/detail/input/parser.hpp | 2 ++ single_include/nlohmann/json.hpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/include/nlohmann/detail/input/parser.hpp b/include/nlohmann/detail/input/parser.hpp index 0b3923610..3a53ff6b3 100644 --- a/include/nlohmann/detail/input/parser.hpp +++ b/include/nlohmann/detail/input/parser.hpp @@ -518,6 +518,8 @@ class parser template bool syntax_error(SAX& sax, const std::string& message) { + // MSVC 2015 reports C4100 (unreferenced parameter) when SAX::parse_error is static + static_cast(sax); return sax.parse_error(m_lexer.get_position(), m_lexer.get_token_string(), parse_error::create(exception_id::syntax_error, m_lexer.get_position(), message, nullptr)); } diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index c135cfda0..c5c40b730 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -18818,6 +18818,8 @@ class parser template bool syntax_error(SAX& sax, const std::string& message) { + // MSVC 2015 reports C4100 (unreferenced parameter) when SAX::parse_error is static + static_cast(sax); return sax.parse_error(m_lexer.get_position(), m_lexer.get_token_string(), parse_error::create(exception_id::syntax_error, m_lexer.get_position(), message, nullptr)); }