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 18template <class T> 19void 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 27template <class T, class A0> 28void 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 36template <class T> 37void 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 45template <class T, class A0> 46void 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 54template <class T, class A0, class A1> 55void 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 63struct A 64{ 65 explicit A(int); 66 A(int, double); 67}; 68 69int 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