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_constructible;
14
15#include <type_traits>
16
17struct A
18{
19    explicit A(int);
20    A(int, double);
21#if __has_feature(cxx_access_control_sfinae)
22private:
23#endif
24    A(char);
25};
26
27template <class T>
28void test_is_constructible()
29{
30    static_assert( (std::is_constructible<T>::value), "");
31}
32
33template <class T, class A0>
34void test_is_constructible()
35{
36    static_assert( (std::is_constructible<T, A0>::value), "");
37}
38
39template <class T, class A0, class A1>
40void test_is_constructible()
41{
42    static_assert( (std::is_constructible<T, A0, A1>::value), "");
43}
44
45template <class T>
46void test_is_not_constructible()
47{
48    static_assert((!std::is_constructible<T>::value), "");
49}
50
51template <class T, class A0>
52void test_is_not_constructible()
53{
54    static_assert((!std::is_constructible<T, A0>::value), "");
55}
56
57int main()
58{
59    test_is_constructible<int> ();
60    test_is_constructible<int, const int> ();
61    test_is_constructible<A, int> ();
62    test_is_constructible<A, int, double> ();
63    test_is_constructible<int&, int&> ();
64
65    test_is_not_constructible<A> ();
66#if __has_feature(cxx_access_control_sfinae)
67    test_is_not_constructible<A, char> ();
68#else
69    test_is_constructible<A, char> ();
70#endif
71    test_is_not_constructible<A, void> ();
72    test_is_not_constructible<void> ();
73    test_is_not_constructible<int&> ();
74}
75