1 //===----------------------------------------------------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // UNSUPPORTED: c++03, c++11, c++14
10 // UNSUPPORTED: no-exceptions
11 // REQUIRES: has-unix-headers
13 // UNSUPPORTED: libcpp-has-no-incomplete-pstl
15 // check that std::any_of(ExecutionPolicy) terminates on user-thrown exceptions
19 #include "check_assertion.h"
20 #include "test_execution_policies.h"
21 #include "test_iterators.h"
23 int main(int, char**) {
24 test_execution_policies([](auto&& policy
) {
25 EXPECT_STD_TERMINATE([&] {
27 (void)std::any_of(policy
, std::begin(a
), std::end(a
), [](int i
) -> bool { throw i
; });
29 EXPECT_STD_TERMINATE([&] {
34 util::throw_on_move_iterator(std::begin(a
), 1),
35 util::throw_on_move_iterator(std::end(a
), 1),
36 [](int) { return true; });
37 } catch (const util::iterator_error
&) {
40 std::terminate(); // make the test pass in case the algorithm didn't move the iterator