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 32 : false_type 33 { }; 34 35 template <class _Tp> 36 struct __is_implicitly_default_constructible<_Tp, decltype(std::__test_implicit_default_constructible<_Tp const&>({})), true_type> 37 : true_type 38 { }; 39 40 template <class _Tp> 41 struct __is_implicitly_default_constructible<_Tp, decltype(std::__test_implicit_default_constructible<_Tp const&>({})), false_type> 42 : false_type 43 { }; 44 #endif // !C++03 45 46 _LIBCPP_END_NAMESPACE_STD 47 48 #endif // _LIBCPP___TYPE_TRAITS_IS_IMPLICITLY_DEFAULT_CONSTRUCTIBLE_H 49