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 | // <tuple> |
10 | |
11 | // constexpr unspecified ignore; |
12 | |
13 | // UNSUPPORTED: c++03 |
14 | |
15 | #include <cassert> |
16 | #include <tuple> |
17 | #include <type_traits> |
18 | |
19 | #include "test_macros.h" |
20 | |
21 | constexpr bool test_ignore_constexpr() |
22 | { |
23 | #if TEST_STD_VER > 11 |
24 | { // Test that std::ignore provides constexpr converting assignment. |
25 | auto& res = (std::ignore = 42); |
26 | assert(&res == &std::ignore); |
27 | } |
28 | { // Test that std::ignore provides constexpr copy/move constructors |
29 | auto copy = std::ignore; |
30 | auto moved = std::move(copy); |
31 | ((void)moved); |
32 | } |
33 | { // Test that std::ignore provides constexpr copy/move assignment |
34 | auto copy = std::ignore; |
35 | copy = std::ignore; |
36 | auto moved = std::ignore; |
37 | moved = std::move(copy); |
38 | } |
39 | #endif |
40 | return true; |
41 | } |
42 | |
43 | int main(int, char**) { |
44 | { |
45 | constexpr auto& ignore_v = std::ignore; |
46 | ((void)ignore_v); |
47 | } |
48 | { |
49 | static_assert(test_ignore_constexpr(), "" ); |
50 | } |
51 | { |
52 | LIBCPP_STATIC_ASSERT(std::is_trivial<decltype(std::ignore)>::value, "" ); |
53 | } |
54 | |
55 | return 0; |
56 | } |
57 | |