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_nothrow_constructible;
14
15#include <type_traits>
16
17template <class T>
18void test_is_nothrow_constructible()
19{
20    static_assert(( std::is_nothrow_constructible<T>::value), "");
21}
22
23template <class T, class A0>
24void test_is_nothrow_constructible()
25{
26    static_assert(( std::is_nothrow_constructible<T, A0>::value), "");
27}
28
29template <class T>
30void test_is_not_nothrow_constructible()
31{
32    static_assert((!std::is_nothrow_constructible<T>::value), "");
33}
34
35template <class T, class A0>
36void test_is_not_nothrow_constructible()
37{
38    static_assert((!std::is_nothrow_constructible<T, A0>::value), "");
39}
40
41template <class T, class A0, class A1>
42void test_is_not_nothrow_constructible()
43{
44    static_assert((!std::is_nothrow_constructible<T, A0, A1>::value), "");
45}
46
47class Empty
48{
49};
50
51class NotEmpty
52{
53    virtual ~NotEmpty();
54};
55
56union Union {};
57
58struct bit_zero
59{
60    int :  0;
61};
62
63class Abstract
64{
65    virtual ~Abstract() = 0;
66};
67
68struct A
69{
70    A(const A&);
71};
72
73int main()
74{
75    test_is_nothrow_constructible<int> ();
76    test_is_nothrow_constructible<int, const int&> ();
77    test_is_nothrow_constructible<Empty> ();
78    test_is_nothrow_constructible<Empty, const Empty&> ();
79
80    test_is_not_nothrow_constructible<A, int> ();
81    test_is_not_nothrow_constructible<A, int, double> ();
82    test_is_not_nothrow_constructible<A> ();
83}
84