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 //===----------------------------------------------------------------------===//
9 #ifndef _LIBCPP___TYPE_TRAITS_IS_IMPLICITLY_DEFAULT_CONSTRUCTIBLE_H
10 #define _LIBCPP___TYPE_TRAITS_IS_IMPLICITLY_DEFAULT_CONSTRUCTIBLE_H
13 #include <__type_traits/integral_constant.h>
14 #include <__type_traits/is_default_constructible.h>
16 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
17 # pragma GCC system_header
20 _LIBCPP_BEGIN_NAMESPACE_STD
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.
28 void __test_implicit_default_constructible(_Tp);
30 template <class _Tp, class = void, class = typename is_default_constructible<_Tp>::type>
31 struct __is_implicitly_default_constructible : false_type {};
34 struct __is_implicitly_default_constructible<_Tp,
35 decltype(std::__test_implicit_default_constructible<_Tp const&>({})),
36 true_type> : true_type {};
39 struct __is_implicitly_default_constructible<_Tp,
40 decltype(std::__test_implicit_default_constructible<_Tp const&>({})),
41 false_type> : false_type {};
44 _LIBCPP_END_NAMESPACE_STD
46 #endif // _LIBCPP___TYPE_TRAITS_IS_IMPLICITLY_DEFAULT_CONSTRUCTIBLE_H