diff --git a/src/json.hpp b/src/json.hpp index d06954be3b..69e18a2ab8 100644 --- a/src/json.hpp +++ b/src/json.hpp @@ -2825,7 +2825,7 @@ class basic_json AllocatorType alloc; alloc.destroy(m_value.object); alloc.deallocate(m_value.object, 1); - break; + return; } case value_t::array: @@ -2833,7 +2833,7 @@ class basic_json AllocatorType alloc; alloc.destroy(m_value.array); alloc.deallocate(m_value.array, 1); - break; + return; } case value_t::string: @@ -2841,15 +2841,21 @@ class basic_json AllocatorType alloc; alloc.destroy(m_value.string); alloc.deallocate(m_value.string, 1); - break; + return; } - default: + case value_t::null: + case value_t::boolean: + case value_t::number_integer: + case value_t::number_unsigned: + case value_t::number_float: + case value_t::discarded: { // all other types need no specific destructor - break; + return; } } + assert(false); } /// @} diff --git a/src/json.hpp.re2c b/src/json.hpp.re2c index c2582290e8..a067bf8e17 100644 --- a/src/json.hpp.re2c +++ b/src/json.hpp.re2c @@ -2825,7 +2825,7 @@ class basic_json AllocatorType alloc; alloc.destroy(m_value.object); alloc.deallocate(m_value.object, 1); - break; + return; } case value_t::array: @@ -2833,7 +2833,7 @@ class basic_json AllocatorType alloc; alloc.destroy(m_value.array); alloc.deallocate(m_value.array, 1); - break; + return; } case value_t::string: @@ -2841,15 +2841,21 @@ class basic_json AllocatorType alloc; alloc.destroy(m_value.string); alloc.deallocate(m_value.string, 1); - break; + return; } - default: + case value_t::null: + case value_t::boolean: + case value_t::number_integer: + case value_t::number_unsigned: + case value_t::number_float: + case value_t::discarded: { // all other types need no specific destructor - break; + return; } } + assert(false); } /// @}