xfail dg-final "Sunk statements: 5" on hppa*64*-*-*
[official-gcc.git] / libstdc++-v3 / testsuite / 23_containers / queue / cmp_c++20.cc
blobc8ea6ef26ee30e2f0b62836df0250320f1acd353
1 // Copyright (C) 2020-2024 Free Software Foundation, Inc.
2 //
3 // This file is part of the GNU ISO C++ Library. This library is free
4 // software; you can redistribute it and/or modify it under the
5 // terms of the GNU General Public License as published by the
6 // Free Software Foundation; either version 3, or (at your option)
7 // any later version.
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License along
15 // with this library; see the file COPYING3. If not see
16 // <http://www.gnu.org/licenses/>.
18 // { dg-do run { target c++20 } }
20 #include <queue>
21 #include <testsuite_hooks.h>
23 void
24 test01()
26 std::queue<int> c1{ {1, 2, 3} }, c2{ {1, 2, 3, 4} }, c3{ {1, 2, 4} };
27 VERIFY( c1 == c1 );
28 VERIFY( std::is_eq(c1 <=> c1) );
29 VERIFY( c1 < c2 );
30 VERIFY( std::is_lt(c1 <=> c2) );
31 VERIFY( c1 < c3 );
32 VERIFY( std::is_lt(c1 <=> c3) );
33 VERIFY( c2 < c3 );
34 VERIFY( std::is_lt(c2 <=> c3) );
36 static_assert( std::totally_ordered<std::queue<int>> );
38 static_assert( std::three_way_comparable<std::queue<int>,
39 std::strong_ordering> );
40 static_assert( ! std::three_way_comparable<std::queue<float>,
41 std::strong_ordering> );
42 static_assert( ! std::three_way_comparable<std::queue<float>,
43 std::weak_ordering> );
44 static_assert( std::three_way_comparable<std::queue<float>,
45 std::partial_ordering> );
47 struct E
49 bool operator==(E) { return true; }
51 static_assert( ! std::three_way_comparable<E> );
52 static_assert( ! std::three_way_comparable<std::queue<E>> );
55 int
56 main()
58 test01();