diff --git a/include/boost/json/detail/parse_into.hpp b/include/boost/json/detail/parse_into.hpp index f05de1f43..8349d4ca5 100644 --- a/include/boost/json/detail/parse_into.hpp +++ b/include/boost/json/detail/parse_into.hpp @@ -829,7 +829,7 @@ class converting_handler if( inner_active_ < N ) { BOOST_JSON_FAIL( ec, error::size_mismatch ); - return true; + return false; } inner_active_ = -1; diff --git a/test/parse_into.cpp b/test/parse_into.cpp index 1c1cb5368..c3c94b6f5 100644 --- a/test/parse_into.cpp +++ b/test/parse_into.cpp @@ -157,9 +157,17 @@ class parse_into_test # pragma GCC diagnostic ignored "-Wmissing-field-initializers" #endif system::error_code ec; - T t{}; + T t1{}; std::string json = serialize(sample); - parser_for p( parse_options{}, &t ); + + parse_into(t1, json, ec); + BOOST_TEST( ec.failed() ); + BOOST_TEST( ec.has_location() ); + BOOST_TEST( ec == e ); + + T t2{}; + ec = {}; + parser_for p( parse_options{}, &t2 ); for( auto& c: json ) { std::size_t const n = p.write_some( true, &c, 1, ec ); @@ -355,6 +363,8 @@ class parse_into_test error::size_mismatch, {1, 2} ); testParseIntoErrors< std::tuple> >( error::size_mismatch, {{1,2}, {3,4}} ); + testParseIntoErrors>>( + error::size_mismatch, { {"tup", array()} }); } void testStruct()