mirror of
https://github.com/nlohmann/json.git
synced 2026-10-10 08:27:13 +00:00
Fix the Visual Studio 2015 build of the recovery code and its tests
- parser::report_error() calls only sax->parse_error(). For a SAX parser whose parse_error() is static, as in unit-disabled_exceptions.cpp, Visual Studio 2015 then reports the parameter as unreferenced (C4100), which /WX turns into an error. - The variadic concatenated() helper in unit-sax_parse.cpp made Visual Studio 2015 fail with an internal compiler error (C1001). It now takes an initializer list of byte vectors. Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
3 files changed
+12
-7
No files matched your search
@@ -20646,6 +20646,7 @@ class parser
|
||||
JSON_INTERNAL_ALWAYS_INLINE
|
||||
std::false_type report_error(SAX* sax, const Exception& ex, std::false_type /*allow_recovery*/)
|
||||
{
|
||||
static_cast<void>(sax); // MSVC 2015 does not count calling a static parse_error() as using it
|
||||
error_reported = true;
|
||||
static_cast<void>(sax->parse_error(m_lexer.get_position(), m_lexer.get_token_string(), ex));
|
||||
return {};
|
||||
@@ -20658,6 +20659,7 @@ class parser
|
||||
template<typename SAX, typename Exception>
|
||||
bool report_error(SAX* sax, const Exception& ex, std::true_type /*allow_recovery*/)
|
||||
{
|
||||
static_cast<void>(sax); // MSVC 2015 does not count calling a static parse_error() as using it
|
||||
const std::size_t position = m_lexer.get_position().chars_read_total;
|
||||
if (error_reported && position == last_error_position && last_token == last_error_token)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user