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