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 #ifndef _LIBCPP___TYPE_TRAITS_IS_IMPLICITLY_DEFAULT_CONSTRUCTIBLE_H
10 #define _LIBCPP___TYPE_TRAITS_IS_IMPLICITLY_DEFAULT_CONSTRUCTIBLE_H
11 
12 #include <__config>
13 #include <__type_traits/integral_constant.h>
14 #include <__type_traits/is_default_constructible.h>
15 
16 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
17 #  pragma GCC system_header
18 #endif
19 
20 _LIBCPP_BEGIN_NAMESPACE_STD
21 
22 #ifndef _LIBCPP_CXX03_LANG
23 // First of all, we can't implement this check in C++03 mode because the {}
24 // default initialization syntax isn't valid.
25 // Second, we implement the trait in a funny manner with two defaulted template
26 // arguments to workaround Clang's PR43454.
27 template <class _Tp>
28 void __test_implicit_default_constructible(_Tp);
29 
30 template <class _Tp, class = void, class = typename is_default_constructible<_Tp>::type>
31 struct __is_implicitly_default_constructible : false_type {};
32 
33 template <class _Tp>
34 struct __is_implicitly_default_constructible<_Tp,
35                                              decltype(std::__test_implicit_default_constructible<_Tp const&>({})),
36                                              true_type> : true_type {};
37 
38 template <class _Tp>
39 struct __is_implicitly_default_constructible<_Tp,
40                                              decltype(std::__test_implicit_default_constructible<_Tp const&>({})),
41                                              false_type> : false_type {};
42 #endif // !C++03
43 
44 _LIBCPP_END_NAMESPACE_STD
45 
46 #endif // _LIBCPP___TYPE_TRAITS_IS_IMPLICITLY_DEFAULT_CONSTRUCTIBLE_H
47