1//===----------------------------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9// type_traits
10
11// template <class T, class... Args>
12// struct is_trivially_constructible;
13
14#include <type_traits>
15#include "test_macros.h"
16
17template <class T>
18void test_is_trivially_constructible()
19{
20 static_assert(( std::is_trivially_constructible<T>::value), "");
21#if TEST_STD_VER > 14
22 static_assert(( std::is_trivially_constructible_v<T>), "");
23#endif
24}
25
26template <class T, class A0>
27void test_is_trivially_constructible()
28{
29 static_assert(( std::is_trivially_constructible<T, A0>::value), "");
30#if TEST_STD_VER > 14
31 static_assert(( std::is_trivially_constructible_v<T, A0>), "");
32#endif
33}
34
35template <class T>
36void test_is_not_trivially_constructible()
37{
38 static_assert((!std::is_trivially_constructible<T>::value), "");
39#if TEST_STD_VER > 14
40 static_assert((!std::is_trivially_constructible_v<T>), "");
41#endif
42}
43
44template <class T, class A0>
45void test_is_not_trivially_constructible()
46{
47 static_assert((!std::is_trivially_constructible<T, A0>::value), "");
48#if TEST_STD_VER > 14
49 static_assert((!std::is_trivially_constructible_v<T, A0>), "");
50#endif
51}
52
53template <class T, class A0, class A1>
54void test_is_not_trivially_constructible()
55{
56 static_assert((!std::is_trivially_constructible<T, A0, A1>::value), "");
57#if TEST_STD_VER > 14
58 static_assert((!std::is_trivially_constructible_v<T, A0, A1>), "");
59#endif
60}
61
62struct A
63{
64 explicit A(int);
65 A(int, double);
66};
67
68int main(int, char**)
69{
70 test_is_trivially_constructible<int> ();
71 test_is_trivially_constructible<int, const int&> ();
72
73 test_is_not_trivially_constructible<A, int> ();
74 test_is_not_trivially_constructible<A, int, double> ();
75 test_is_not_trivially_constructible<A> ();
76
77 return 0;
78}
79

source code of libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_constructible.pass.cpp