1 //===----------------------------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
11 // template <class T, class... Args>
12 // struct is_nothrow_constructible;
14 #include <type_traits>
15 #include "test_macros.h"
20 void test_is_nothrow_constructible()
22 static_assert(( std::is_nothrow_constructible
<T
>::value
), "");
24 static_assert(( std::is_nothrow_constructible_v
<T
>), "");
28 template <class T
, class A0
>
29 void test_is_nothrow_constructible()
31 static_assert(( std::is_nothrow_constructible
<T
, A0
>::value
), "");
33 static_assert(( std::is_nothrow_constructible_v
<T
, A0
>), "");
38 void test_is_not_nothrow_constructible()
40 static_assert((!std::is_nothrow_constructible
<T
>::value
), "");
42 static_assert((!std::is_nothrow_constructible_v
<T
>), "");
46 template <class T
, class A0
>
47 void test_is_not_nothrow_constructible()
49 static_assert((!std::is_nothrow_constructible
<T
, A0
>::value
), "");
51 static_assert((!std::is_nothrow_constructible_v
<T
, A0
>), "");
55 template <class T
, class A0
, class A1
>
56 void test_is_not_nothrow_constructible()
58 static_assert((!std::is_nothrow_constructible
<T
, A0
, A1
>::value
), "");
60 static_assert((!std::is_nothrow_constructible_v
<T
, A0
, A1
>), "");
67 void operator=(C
&); // not const
70 #if TEST_STD_VER >= 11
72 Tuple(Empty
&&) noexcept
{}
78 test_is_nothrow_constructible
<int> ();
79 test_is_nothrow_constructible
<int, const int&> ();
80 test_is_nothrow_constructible
<Empty
> ();
81 test_is_nothrow_constructible
<Empty
, const Empty
&> ();
83 test_is_not_nothrow_constructible
<A
, int> ();
84 test_is_not_nothrow_constructible
<A
, int, double> ();
85 test_is_not_nothrow_constructible
<A
> ();
86 test_is_not_nothrow_constructible
<C
> ();
87 #if TEST_STD_VER >= 11
88 test_is_nothrow_constructible
<Tuple
&&, Empty
> (); // See bug #19616.
90 static_assert(!std::is_constructible
<Tuple
&, Empty
>::value
, "");
91 test_is_not_nothrow_constructible
<Tuple
&, Empty
> (); // See bug #19616.