Debian Codegraph @

libstdc++-v3/testsuite/20_util/headers/utility/ignore.cc

raw
1 // { dg-do compile { target c++11 } }
2
3 // P2968R2 Make std::ignore a first-class object.
4 // This is a C++26 change, but we treat it as a DR against C++11.
5
6 // C++26 [tuple.general]:
7 // In addition to being available via inclusion of the <tuple> header,
8 // ignore is available when <utility> is included.
9 #include <utility>
10
11 using ignore_type = std::remove_const<decltype(std::ignore)>::type;
12
13 #ifdef __cpp_lib_is_aggregate
14 static_assert( std::is_aggregate_v<ignore_type> );
15 #endif
16
17 static_assert( std::is_nothrow_default_constructible<ignore_type>::value, "" );
18 static_assert( std::is_nothrow_copy_constructible<ignore_type>::value, "" );
19 static_assert( std::is_nothrow_copy_assignable<ignore_type>::value, "" );
20
21 static_assert( std::is_nothrow_assignable<const ignore_type&, int>::value,
22 "assignable from arbitrary types" );
23 static_assert( std::is_nothrow_assignable<const ignore_type&, long*>::value,
24 "assignable from arbitrary types" );
25
26 constexpr ignore_type ignore;
27 constexpr ignore_type ignore_more(ignore);
28 constexpr ignore_type ignore_morer(ignore = ignore);
29 constexpr ignore_type ignore_morest(ignore = "");