is_nothrow_constructible.pass.cpp revision 6063ec176d5056683d6ddd310c2e3a8f1c7e1b46
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
17class Empty
18{
19};
20
21class NotEmpty
22{
23    virtual ~NotEmpty();
24};
25
26union Union {};
27
28struct bit_zero
29{
30    int :  0;
31};
32
33class Abstract
34{
35    virtual ~Abstract() = 0;
36};
37
38struct A
39{
40    A(const A&);
41};
42
43int main()
44{
45    static_assert(( std::is_nothrow_constructible<int>::value), "");
46    static_assert(( std::is_nothrow_constructible<int, const int&>::value), "");
47    static_assert((!std::is_nothrow_constructible<A, int>::value), "");
48    static_assert((!std::is_nothrow_constructible<A, int, double>::value), "");
49    static_assert((!std::is_nothrow_constructible<A>::value), "");
50    static_assert(( std::is_nothrow_constructible<Empty>::value), "");
51    static_assert(( std::is_nothrow_constructible<Empty, const Empty&>::value), "");
52}
53