Home | History | Annotate | Download | only in meta.unary.prop
      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 // type_traits
     11 
     12 // has_nothrow_move_constructor
     13 
     14 #include <type_traits>
     15 
     16 template <class T>
     17 void test_is_nothrow_move_constructible()
     18 {
     19     static_assert( std::is_nothrow_move_constructible<T>::value, "");
     20     static_assert( std::is_nothrow_move_constructible<const T>::value, "");
     21 }
     22 
     23 template <class T>
     24 void test_has_not_nothrow_move_constructor()
     25 {
     26     static_assert(!std::is_nothrow_move_constructible<T>::value, "");
     27     static_assert(!std::is_nothrow_move_constructible<const T>::value, "");
     28     static_assert(!std::is_nothrow_move_constructible<volatile T>::value, "");
     29     static_assert(!std::is_nothrow_move_constructible<const volatile T>::value, "");
     30 }
     31 
     32 class Empty
     33 {
     34 };
     35 
     36 union Union {};
     37 
     38 struct bit_zero
     39 {
     40     int :  0;
     41 };
     42 
     43 struct A
     44 {
     45     A(const A&);
     46 };
     47 
     48 int main()
     49 {
     50     test_has_not_nothrow_move_constructor<void>();
     51     test_has_not_nothrow_move_constructor<A>();
     52 
     53     test_is_nothrow_move_constructible<int&>();
     54     test_is_nothrow_move_constructible<Union>();
     55     test_is_nothrow_move_constructible<Empty>();
     56     test_is_nothrow_move_constructible<int>();
     57     test_is_nothrow_move_constructible<double>();
     58     test_is_nothrow_move_constructible<int*>();
     59     test_is_nothrow_move_constructible<const int*>();
     60     test_is_nothrow_move_constructible<bit_zero>();
     61 }
     62