diff --git a/libcxx/test/libcxx/containers/iterator.rel_ops.compile.pass.cpp b/libcxx/test/libcxx/containers/iterator.rel_ops.compile.pass.cpp new file mode 100644 --- /dev/null +++ b/libcxx/test/libcxx/containers/iterator.rel_ops.compile.pass.cpp @@ -0,0 +1,57 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// Make sure the various container's iterators are not broken by the use of `std::rel_ops`. + +#include // for std::rel_ops + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std::rel_ops; + +template +void test() { + Container const c = Container(); + typename Container::const_iterator it1 = c.end(), it2 = c.end(); + (void)(it1 == it2); + (void)(it1 != it2); +} + +template +void test_random_access() { + Container const c = Container(); + typename Container::const_iterator it1 = c.end(), it2 = c.end(); + (void)(it1 == it2); + (void)(it1 != it2); + (void)(it1 < it2); + (void)(it1 > it2); + (void)(it1 <= it2); + (void)(it1 >= it2); +} + +template void test_random_access >(); +template void test_random_access >(); +template void test >(); +template void test >(); +template void test >(); +template void test >(); +template void test >(); +template void test >(); +template void test >(); +template void test >(); +template void test >(); +template void test >(); +template void test_random_access >();