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 |
10 | // REQUIRES: availability-synchronization_library-missing |
11 | |
12 | // Test the availability markup on std::barrier. |
13 | |
14 | #include <barrier> |
15 | #include <utility> |
16 | |
17 | struct CompletionF { |
18 | void operator()() { } |
19 | }; |
20 | |
21 | void f() { |
22 | // Availability markup on std::barrier<> |
23 | { |
24 | std::barrier<> b(10); // expected-error {{is unavailable}} |
25 | auto token = b.arrive(); // expected-error {{is unavailable}} |
26 | (void)b.arrive(10); // expected-error {{is unavailable}} |
27 | b.wait(std::move(token)); // expected-error {{is unavailable}} |
28 | b.arrive_and_wait(); // expected-error {{is unavailable}} |
29 | b.arrive_and_drop(); // expected-error {{is unavailable}} |
30 | } |
31 | |
32 | // Availability markup on std::barrier<CompletionF> with non-default CompletionF |
33 | { |
34 | std::barrier<CompletionF> b(10); // expected-error {{is unavailable}} |
35 | auto token = b.arrive(); // expected-error {{is unavailable}} |
36 | (void)b.arrive(10); // expected-error {{is unavailable}} |
37 | b.wait(std::move(token)); // expected-error {{is unavailable}} |
38 | b.arrive_and_wait(); // expected-error {{is unavailable}} |
39 | b.arrive_and_drop(); // expected-error {{is unavailable}} |
40 | } |
41 | } |
42 | |