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 // template <class T, class... Args>
     13 //   struct is_trivially_constructible;
     14 
     15 #include <type_traits>
     16 #include "test_macros.h"
     17 
     18 template <class T>
     19 void test_is_trivially_constructible()
     20 {
     21     static_assert(( std::is_trivially_constructible<T>::value), "");
     22 #if TEST_STD_VER > 14
     23     static_assert(( std::is_trivially_constructible_v<T>), "");
     24 #endif
     25 }
     26 
     27 template <class T, class A0>
     28 void test_is_trivially_constructible()
     29 {
     30     static_assert(( std::is_trivially_constructible<T, A0>::value), "");
     31 #if TEST_STD_VER > 14
     32     static_assert(( std::is_trivially_constructible_v<T, A0>), "");
     33 #endif
     34 }
     35 
     36 template <class T>
     37 void test_is_not_trivially_constructible()
     38 {
     39     static_assert((!std::is_trivially_constructible<T>::value), "");
     40 #if TEST_STD_VER > 14
     41     static_assert((!std::is_trivially_constructible_v<T>), "");
     42 #endif
     43 }
     44 
     45 template <class T, class A0>
     46 void test_is_not_trivially_constructible()
     47 {
     48     static_assert((!std::is_trivially_constructible<T, A0>::value), "");
     49 #if TEST_STD_VER > 14
     50     static_assert((!std::is_trivially_constructible_v<T, A0>), "");
     51 #endif
     52 }
     53 
     54 template <class T, class A0, class A1>
     55 void test_is_not_trivially_constructible()
     56 {
     57     static_assert((!std::is_trivially_constructible<T, A0, A1>::value), "");
     58 #if TEST_STD_VER > 14
     59     static_assert((!std::is_trivially_constructible_v<T, A0, A1>), "");
     60 #endif
     61 }
     62 
     63 struct A
     64 {
     65     explicit A(int);
     66     A(int, double);
     67 };
     68 
     69 int main()
     70 {
     71     test_is_trivially_constructible<int> ();
     72     test_is_trivially_constructible<int, const int&> ();
     73 
     74     test_is_not_trivially_constructible<A, int> ();
     75     test_is_not_trivially_constructible<A, int, double> ();
     76     test_is_not_trivially_constructible<A> ();
     77 }
     78