diff --git a/tests/src/unit-custom-array-type.cpp b/tests/src/unit-custom-array-type.cpp index 1e25de188..df66340a1 100644 --- a/tests/src/unit-custom-array-type.cpp +++ b/tests/src/unit-custom-array-type.cpp @@ -41,15 +41,25 @@ using no_at_json = nlohmann::basic_json; TEST_CASE("array type without capacity()") { - SECTION("the iterators of the default configuration stay nothrow movable") + SECTION("the iterators take their exception specification from the container") { - // basic_json's iterators take their exception specification from the - // container iterators; std::deque's is not nothrow move constructible - // with older standard libraries, which must not cost the default - // configuration its noexcept - CHECK(std::is_nothrow_move_constructible::value); - CHECK(std::is_nothrow_move_assignable::value); - CHECK(std::is_nothrow_move_constructible::value); + // basic_json's iterators move exactly as the container iterators do: + // their move operations are defaulted without a declared noexcept, + // because an array or object type whose iterator is not nothrow move + // constructible would otherwise have them deleted (std::deque's is not + // with libstdc++ before 11, and neither are MSVC's debug iterators) + CHECK(std::is_nothrow_move_constructible::value == + (std::is_nothrow_move_constructible::value + && std::is_nothrow_move_constructible::value)); + CHECK(std::is_nothrow_move_assignable::value == + (std::is_nothrow_move_assignable::value + && std::is_nothrow_move_assignable::value)); + CHECK(std::is_nothrow_move_constructible::value == + (std::is_nothrow_move_constructible::value + && std::is_nothrow_move_constructible::value)); + + // and they are movable at all, which is what dropping the declared + // noexcept buys for a std::deque array CHECK(std::is_move_constructible::value); CHECK(std::is_move_assignable::value); }