1 | //===----------------------------------------------------------------------===// |
2 | // |
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 |
6 | // |
7 | //===----------------------------------------------------------------------===// |
8 | |
9 | // UNSUPPORTED: c++03, c++11, c++14 |
10 | // UNSUPPORTED: no-exceptions |
11 | // `check_assertion.h` requires Unix headers and regex support. |
12 | // UNSUPPORTED: !has-unix-headers, no-localization |
13 | |
14 | // UNSUPPORTED: libcpp-has-no-incomplete-pstl |
15 | |
16 | // check that std::find(ExecutionPolicy), std::find_if(ExecutionPolicy) and std::find_if_not(ExecutionPolicy) terminate |
17 | // on user-thrown exceptions |
18 | |
19 | #include <algorithm> |
20 | |
21 | #include "check_assertion.h" |
22 | #include "test_execution_policies.h" |
23 | #include "test_iterators.h" |
24 | |
25 | int main(int, char**) { |
26 | test_execution_policies([](auto&& policy) { |
27 | EXPECT_STD_TERMINATE([&] { |
28 | try { |
29 | int a[] = {1, 2}; |
30 | int b[] = {1, 2}; |
31 | (void)std::rotate_copy( |
32 | policy, |
33 | util::throw_on_move_iterator(std::begin(a), 1), |
34 | util::throw_on_move_iterator(std::begin(a), 1), |
35 | util::throw_on_move_iterator(std::end(a), 1), |
36 | util::throw_on_move_iterator(std::begin(b), 1)); |
37 | } catch (const util::iterator_error&) { |
38 | assert(false); |
39 | } |
40 | std::terminate(); // make the test pass in case the algorithm didn't move the iterator |
41 | }); |
42 | }); |
43 | } |
44 | |