Home | History | Annotate | Download | only in tuple.general
      1 //===----------------------------------------------------------------------===//
      2 //
      3 //                     The LLVM Compiler Infrastructure
      4 //
      5 // This file is dual licensed under the MIT and the University of Illinois Open
      6 // Source Licenses. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 
     10 // <tuple>
     11 
     12 // constexpr unspecified ignore;
     13 
     14 // UNSUPPORTED: c++98, c++03
     15 
     16 #include <tuple>
     17 #include <cassert>
     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() {
     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