diff --git a/include/boost/json/impl/array.ipp b/include/boost/json/impl/array.ipp index cbd06e4b..5cd68bd1 100644 --- a/include/boost/json/impl/array.ipp +++ b/include/boost/json/impl/array.ipp @@ -593,7 +593,6 @@ void array:: swap(array& other) { - BOOST_ASSERT(this != &other); if(*sp_ == *other.sp_) { t_ = detail::exchange( diff --git a/test/array.cpp b/test/array.cpp index ace871bf..0c06f961 100644 --- a/test/array.cpp +++ b/test/array.cpp @@ -1154,6 +1154,12 @@ public: check(a1); BOOST_TEST(a2.size() == 1); }); + fail_loop([&](storage_ptr const& sp) + { + array a({1, true, str_}, sp); + swap(a, a); + check(a); + }); } }