From: Jonathan Wakely Date: Fri, 24 Sep 2021 12:21:34 +0000 (+0100) Subject: libstdc++: Fix tests that use invalid types in ordered containers X-Git-Tag: basepoints/gcc-13~4376 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4000d722e609bbbb1e923721b54911bb784eeec3;p=thirdparty%2Fgcc.git libstdc++: Fix tests that use invalid types in ordered containers Types used in ordered containers need to be comparable, or the container needs to use a custom comparison function. These tests fail when _GLIBCXX_CONCEPT_CHECKS is defined, because the element types aren't comparable. Signed-off-by: Jonathan Wakely libstdc++-v3/ChangeLog: * testsuite/20_util/is_nothrow_swappable/value.h: Use custom comparison function for priority_queue of type with no relational operators. * testsuite/20_util/is_swappable/value.h: Likewise. * testsuite/24_iterators/output/concept.cc: Add operator< to type used in set. --- diff --git a/libstdc++-v3/testsuite/20_util/is_nothrow_swappable/value.h b/libstdc++-v3/testsuite/20_util/is_nothrow_swappable/value.h index 62b3db8dc1f2..d6f166bee467 100644 --- a/libstdc++-v3/testsuite/20_util/is_nothrow_swappable/value.h +++ b/libstdc++-v3/testsuite/20_util/is_nothrow_swappable/value.h @@ -285,7 +285,9 @@ void test01() static_assert(test_property>(true), ""); static_assert(test_property>(true), ""); + std::priority_queue, + comps::CompareNoThrowCopyable>>(true), ""); static_assert(test_property>(true), ""); static_assert(test_property + bool operator()(const T&, const T&) const + { return false; } + }; } void test01() { @@ -152,7 +159,9 @@ void test01() static_assert(test_property[1][2][3]>(true), ""); static_assert(test_property>(true), ""); + std::priority_queue, + funny::DummyCmp>>(true), ""); static_assert(test_property>(true), ""); static_assert(test_property::iterator, int > ); static_assert( output_iterator< array::iterator, B > );