diff --git a/libcxx/include/CMakeLists.txt b/libcxx/include/CMakeLists.txt --- a/libcxx/include/CMakeLists.txt +++ b/libcxx/include/CMakeLists.txt @@ -446,22 +446,29 @@ __type_traits/add_pointer.h __type_traits/add_rvalue_reference.h __type_traits/add_volatile.h + __type_traits/alignment_of.h __type_traits/conditional.h __type_traits/decay.h __type_traits/enable_if.h __type_traits/extent.h + __type_traits/has_unique_object_representation.h + __type_traits/has_virtual_destructor.h __type_traits/integral_constant.h __type_traits/is_abstract.h __type_traits/is_aggregate.h __type_traits/is_arithmetic.h __type_traits/is_array.h + __type_traits/is_assignable.h __type_traits/is_base_of.h __type_traits/is_bounded_array.h __type_traits/is_callable.h __type_traits/is_class.h __type_traits/is_compound.h __type_traits/is_const.h + __type_traits/is_constant_evaluated.h __type_traits/is_convertible.h + __type_traits/is_copy_assignable.h + __type_traits/is_core_convertible.h __type_traits/is_empty.h __type_traits/is_enum.h __type_traits/is_final.h @@ -469,18 +476,26 @@ __type_traits/is_function.h __type_traits/is_fundamental.h __type_traits/is_integral.h + __type_traits/is_literal_type.h __type_traits/is_member_function_pointer.h __type_traits/is_member_object_pointer.h __type_traits/is_member_pointer.h + __type_traits/is_move_assignable.h __type_traits/is_null_pointer.h __type_traits/is_object.h + __type_traits/is_pod.h __type_traits/is_pointer.h + __type_traits/is_polymorphic.h __type_traits/is_reference.h __type_traits/is_reference_wrapper.h __type_traits/is_referenceable.h __type_traits/is_same.h __type_traits/is_scalar.h + __type_traits/is_scoped_enum.h __type_traits/is_signed.h + __type_traits/is_standard_layout.h + __type_traits/is_trivial.h + __type_traits/is_trivially_copyable.h __type_traits/is_unbounded_array.h __type_traits/is_union.h __type_traits/is_unsigned.h @@ -495,6 +510,7 @@ __type_traits/remove_reference.h __type_traits/remove_volatile.h __type_traits/type_identity.h + __type_traits/underlying_type.h __undef_macros __utility/as_const.h __utility/auto_cast.h diff --git a/libcxx/include/__functional/invoke.h b/libcxx/include/__functional/invoke.h --- a/libcxx/include/__functional/invoke.h +++ b/libcxx/include/__functional/invoke.h @@ -11,16 +11,269 @@ #define _LIBCPP___FUNCTIONAL_INVOKE_H #include <__config> -#include <__functional/weak_result_type.h> +#include <__type_traits/conditional.h> +#include <__type_traits/decay.h> +#include <__type_traits/enable_if.h> +#include <__type_traits/integral_constant.h> +#include <__type_traits/is_base_of.h> +#include <__type_traits/is_core_convertible.h> +#include <__type_traits/is_member_function_pointer.h> +#include <__type_traits/is_member_object_pointer.h> +#include <__type_traits/is_reference_wrapper.h> +#include <__type_traits/is_same.h> +#include <__type_traits/is_void.h> +#include <__utility/declval.h> #include <__utility/forward.h> -#include #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif +// TODO: Disentangle the type traits and std::invoke properly + _LIBCPP_BEGIN_NAMESPACE_STD +struct __any +{ + __any(...); +}; + +struct __nat +{ +#ifndef _LIBCPP_CXX03_LANG + __nat() = delete; + __nat(const __nat&) = delete; + __nat& operator=(const __nat&) = delete; + ~__nat() = delete; +#endif +}; + +template +struct __member_pointer_class_type {}; + +template +struct __member_pointer_class_type<_Ret _ClassType::*> { + typedef _ClassType type; +}; + +#ifndef _LIBCPP_CXX03_LANG + +template ::type, + class _DecayA0 = typename decay<_A0>::type, + class _ClassT = typename __member_pointer_class_type<_DecayFp>::type> +using __enable_if_bullet1 = typename enable_if + < + is_member_function_pointer<_DecayFp>::value + && is_base_of<_ClassT, _DecayA0>::value + >::type; + +template ::type, + class _DecayA0 = typename decay<_A0>::type> +using __enable_if_bullet2 = typename enable_if + < + is_member_function_pointer<_DecayFp>::value + && __is_reference_wrapper<_DecayA0>::value + >::type; + +template ::type, + class _DecayA0 = typename decay<_A0>::type, + class _ClassT = typename __member_pointer_class_type<_DecayFp>::type> +using __enable_if_bullet3 = typename enable_if + < + is_member_function_pointer<_DecayFp>::value + && !is_base_of<_ClassT, _DecayA0>::value + && !__is_reference_wrapper<_DecayA0>::value + >::type; + +template ::type, + class _DecayA0 = typename decay<_A0>::type, + class _ClassT = typename __member_pointer_class_type<_DecayFp>::type> +using __enable_if_bullet4 = typename enable_if + < + is_member_object_pointer<_DecayFp>::value + && is_base_of<_ClassT, _DecayA0>::value + >::type; + +template ::type, + class _DecayA0 = typename decay<_A0>::type> +using __enable_if_bullet5 = typename enable_if + < + is_member_object_pointer<_DecayFp>::value + && __is_reference_wrapper<_DecayA0>::value + >::type; + +template ::type, + class _DecayA0 = typename decay<_A0>::type, + class _ClassT = typename __member_pointer_class_type<_DecayFp>::type> +using __enable_if_bullet6 = typename enable_if + < + is_member_object_pointer<_DecayFp>::value + && !is_base_of<_ClassT, _DecayA0>::value + && !__is_reference_wrapper<_DecayA0>::value + >::type; + +// __invoke forward declarations + +// fall back - none of the bullets + +template +auto __invoke(__any, _Args&& ...__args) -> __nat; + +// bullets 1, 2 and 3 + +template > +inline _LIBCPP_INLINE_VISIBILITY +constexpr auto +__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args) + noexcept(noexcept((static_cast<_A0&&>(__a0).*__f)(static_cast<_Args&&>(__args)...))) + -> decltype( (static_cast<_A0&&>(__a0).*__f)(static_cast<_Args&&>(__args)...)) + { return (static_cast<_A0&&>(__a0).*__f)(static_cast<_Args&&>(__args)...); } + +template > +inline _LIBCPP_INLINE_VISIBILITY +constexpr auto +__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args) + noexcept(noexcept((__a0.get().*__f)(static_cast<_Args&&>(__args)...))) + -> decltype( (__a0.get().*__f)(static_cast<_Args&&>(__args)...)) + { return (__a0.get().*__f)(static_cast<_Args&&>(__args)...); } + +template > +inline _LIBCPP_INLINE_VISIBILITY +constexpr auto +__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args) + noexcept(noexcept(((*static_cast<_A0&&>(__a0)).*__f)(static_cast<_Args&&>(__args)...))) + -> decltype( ((*static_cast<_A0&&>(__a0)).*__f)(static_cast<_Args&&>(__args)...)) + { return ((*static_cast<_A0&&>(__a0)).*__f)(static_cast<_Args&&>(__args)...); } + +// bullets 4, 5 and 6 + +template > +inline _LIBCPP_INLINE_VISIBILITY +constexpr auto +__invoke(_Fp&& __f, _A0&& __a0) + noexcept(noexcept(static_cast<_A0&&>(__a0).*__f)) + -> decltype( static_cast<_A0&&>(__a0).*__f) + { return static_cast<_A0&&>(__a0).*__f; } + +template > +inline _LIBCPP_INLINE_VISIBILITY +constexpr auto +__invoke(_Fp&& __f, _A0&& __a0) + noexcept(noexcept(__a0.get().*__f)) + -> decltype( __a0.get().*__f) + { return __a0.get().*__f; } + +template > +inline _LIBCPP_INLINE_VISIBILITY +constexpr auto +__invoke(_Fp&& __f, _A0&& __a0) + noexcept(noexcept((*static_cast<_A0&&>(__a0)).*__f)) + -> decltype( (*static_cast<_A0&&>(__a0)).*__f) + { return (*static_cast<_A0&&>(__a0)).*__f; } + +// bullet 7 + +template +inline _LIBCPP_INLINE_VISIBILITY +constexpr auto +__invoke(_Fp&& __f, _Args&& ...__args) + noexcept(noexcept(static_cast<_Fp&&>(__f)(static_cast<_Args&&>(__args)...))) + -> decltype( static_cast<_Fp&&>(__f)(static_cast<_Args&&>(__args)...)) + { return static_cast<_Fp&&>(__f)(static_cast<_Args&&>(__args)...); } + +// __invokable +template +struct __invokable_r +{ + template + static auto __try_call(int) -> decltype( + _VSTD::__invoke(declval<_XFp>(), declval<_XArgs>()...)); + template + static __nat __try_call(...); + + // FIXME: Check that _Ret, _Fp, and _Args... are all complete types, cv void, + // or incomplete array types as required by the standard. + using _Result = decltype(__try_call<_Fp, _Args...>(0)); + + using type = typename conditional< + _IsNotSame<_Result, __nat>::value, + typename conditional< is_void<_Ret>::value, true_type, __is_core_convertible<_Result, _Ret> >::type, + false_type >::type; + static const bool value = type::value; +}; +template +using __invokable = __invokable_r; + +template +struct __nothrow_invokable_r_imp { + static const bool value = false; +}; + +template +struct __nothrow_invokable_r_imp +{ + typedef __nothrow_invokable_r_imp _ThisT; + + template + static void __test_noexcept(_Tp) noexcept; + + static const bool value = noexcept(_ThisT::__test_noexcept<_Ret>( + _VSTD::__invoke(declval<_Fp>(), declval<_Args>()...))); +}; + +template +struct __nothrow_invokable_r_imp +{ + static const bool value = noexcept( + _VSTD::__invoke(declval<_Fp>(), declval<_Args>()...)); +}; + +template +using __nothrow_invokable_r = + __nothrow_invokable_r_imp< + __invokable_r<_Ret, _Fp, _Args...>::value, + is_void<_Ret>::value, + _Ret, _Fp, _Args... + >; + +template +using __nothrow_invokable = + __nothrow_invokable_r_imp< + __invokable<_Fp, _Args...>::value, + true, void, _Fp, _Args... + >; + +template +struct __invoke_of + : public enable_if< + __invokable<_Fp, _Args...>::value, + typename __invokable_r::_Result> +{ +}; + +#else + +// Assume that it's a functor in C++03 +template +_LIBCPP_HIDE_FROM_ABI +decltype(std::declval<_Func>()(std::declval<_Args>()...)) __invoke(_Func&& __func, _Args&&... __args) { + return static_cast<_Func&&>(__func)(static_cast<_Args&&>(__args)...); +} + +#endif // _LIBCPP_CXX03_LANG + template ::value> struct __invoke_void_return_wrapper { @@ -85,6 +338,47 @@ #if _LIBCPP_STD_VER > 14 +// is_invocable + +template +struct _LIBCPP_TEMPLATE_VIS is_invocable + : integral_constant::value> {}; + +template +struct _LIBCPP_TEMPLATE_VIS is_invocable_r + : integral_constant::value> {}; + +template +inline constexpr bool is_invocable_v = is_invocable<_Fn, _Args...>::value; + +template +inline constexpr bool is_invocable_r_v = is_invocable_r<_Ret, _Fn, _Args...>::value; + +// is_nothrow_invocable + +template +struct _LIBCPP_TEMPLATE_VIS is_nothrow_invocable + : integral_constant::value> {}; + +template +struct _LIBCPP_TEMPLATE_VIS is_nothrow_invocable_r + : integral_constant::value> {}; + +template +inline constexpr bool is_nothrow_invocable_v = is_nothrow_invocable<_Fn, _Args...>::value; + +template +inline constexpr bool is_nothrow_invocable_r_v = is_nothrow_invocable_r<_Ret, _Fn, _Args...>::value; + +template +struct _LIBCPP_TEMPLATE_VIS invoke_result + : __invoke_of<_Fn, _Args...> +{ +}; + +template +using invoke_result_t = typename invoke_result<_Fn, _Args...>::type; + template _LIBCPP_CONSTEXPR_AFTER_CXX17 invoke_result_t<_Fn, _Args...> invoke(_Fn&& __f, _Args&&... __args) diff --git a/libcxx/include/__type_traits/alignment_of.h b/libcxx/include/__type_traits/alignment_of.h new file mode 100644 --- /dev/null +++ b/libcxx/include/__type_traits/alignment_of.h @@ -0,0 +1,32 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCPP___TYPE_TRAITS_ALIGNMENT_OF_H +#define _LIBCPP___TYPE_TRAITS_ALIGNMENT_OF_H + +#include <__config> +#include <__type_traits/integral_constant.h> +#include + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +template struct _LIBCPP_TEMPLATE_VIS alignment_of + : public integral_constant {}; + +#if _LIBCPP_STD_VER > 14 +template +inline constexpr size_t alignment_of_v = alignment_of<_Tp>::value; +#endif + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_ALIGNMENT_OF_H diff --git a/libcxx/include/__type_traits/has_unique_object_representation.h b/libcxx/include/__type_traits/has_unique_object_representation.h new file mode 100644 --- /dev/null +++ b/libcxx/include/__type_traits/has_unique_object_representation.h @@ -0,0 +1,36 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCPP___TYPE_TRAITS_HAS_UNIQUE_OBJECT_REPRESENTATION_H +#define _LIBCPP___TYPE_TRAITS_HAS_UNIQUE_OBJECT_REPRESENTATION_H + +#include <__config> +#include <__type_traits/integral_constant.h> +#include <__type_traits/remove_all_extents.h> +#include <__type_traits/remove_cv.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +#if _LIBCPP_STD_VER > 14 + +template struct _LIBCPP_TEMPLATE_VIS has_unique_object_representations + : public integral_constant>)> {}; + +template +inline constexpr bool has_unique_object_representations_v = has_unique_object_representations<_Tp>::value; + +#endif + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_HAS_UNIQUE_OBJECT_REPRESENTATION_H diff --git a/libcxx/include/__type_traits/has_virtual_destructor.h b/libcxx/include/__type_traits/has_virtual_destructor.h new file mode 100644 --- /dev/null +++ b/libcxx/include/__type_traits/has_virtual_destructor.h @@ -0,0 +1,40 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCPP___TYPE_TRAITS_HAS_VIRTUAL_DESTRUCTOR_H +#define _LIBCPP___TYPE_TRAITS_HAS_VIRTUAL_DESTRUCTOR_H + +#include <__config> +#include <__type_traits/integral_constant.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +#if __has_feature(has_virtual_destructor) || defined(_LIBCPP_COMPILER_GCC) + +template struct _LIBCPP_TEMPLATE_VIS has_virtual_destructor + : public integral_constant {}; + +#else + +template struct _LIBCPP_TEMPLATE_VIS has_virtual_destructor + : public false_type {}; + +#endif + +#if _LIBCPP_STD_VER > 14 +template +inline constexpr bool has_virtual_destructor_v = has_virtual_destructor<_Tp>::value; +#endif + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_HAS_VIRTUAL_DESTRUCTOR_H diff --git a/libcxx/include/__type_traits/is_assignable.h b/libcxx/include/__type_traits/is_assignable.h new file mode 100644 --- /dev/null +++ b/libcxx/include/__type_traits/is_assignable.h @@ -0,0 +1,66 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCPP___TYPE_TRAITS_IS_ASSIGNABLE_H +#define _LIBCPP___TYPE_TRAITS_IS_ASSIGNABLE_H + +#include <__config> +#include <__type_traits/integral_constant.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +template struct __select_2nd { typedef _LIBCPP_NODEBUG _Tp type; }; + +#if __has_keyword(__is_assignable) + +template +struct _LIBCPP_TEMPLATE_VIS is_assignable : _BoolConstant<__is_assignable(_Tp, _Up)> { }; + +#if _LIBCPP_STD_VER > 14 +template +inline constexpr bool is_assignable_v = __is_assignable(_Tp, _Arg); +#endif + +#else // __has_keyword(__is_assignable) + +template +typename __select_2nd() = declval<_Arg>())), true_type>::type +__is_assignable_test(int); + +template +false_type __is_assignable_test(...); + + +template ::value || is_void<_Arg>::value> +struct __is_assignable_imp + : public decltype((_VSTD::__is_assignable_test<_Tp, _Arg>(0))) {}; + +template +struct __is_assignable_imp<_Tp, _Arg, true> + : public false_type +{ +}; + +template +struct is_assignable + : public __is_assignable_imp<_Tp, _Arg> {}; + +#if _LIBCPP_STD_VER > 14 +template +inline constexpr bool is_assignable_v = is_assignable<_Tp, _Arg>::value; +#endif + +#endif // __has_keyword(__is_assignable) + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_IS_ASSIGNABLE_H diff --git a/libcxx/include/__type_traits/is_constant_evaluated.h b/libcxx/include/__type_traits/is_constant_evaluated.h new file mode 100644 --- /dev/null +++ b/libcxx/include/__type_traits/is_constant_evaluated.h @@ -0,0 +1,32 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCPP___TYPE_TRAITS_IS_CONSTANT_EVALUATED_H +#define _LIBCPP___TYPE_TRAITS_IS_CONSTANT_EVALUATED_H + +#include <__config> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +#if _LIBCPP_STD_VER > 17 +_LIBCPP_INLINE_VISIBILITY +inline constexpr bool is_constant_evaluated() noexcept { + return __builtin_is_constant_evaluated(); +} +#endif + +inline _LIBCPP_CONSTEXPR +bool __libcpp_is_constant_evaluated() _NOEXCEPT { return __builtin_is_constant_evaluated(); } + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_IS_CONSTANT_EVALUATED_H diff --git a/libcxx/include/__type_traits/is_copy_assignable.h b/libcxx/include/__type_traits/is_copy_assignable.h new file mode 100644 --- /dev/null +++ b/libcxx/include/__type_traits/is_copy_assignable.h @@ -0,0 +1,35 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCPP___TYPE_TRAITS_IS_COPY_ASSIGNABLE_H +#define _LIBCPP___TYPE_TRAITS_IS_COPY_ASSIGNABLE_H + +#include <__config> +#include <__type_traits/add_const.h> +#include <__type_traits/add_lvalue_reference.h> +#include <__type_traits/integral_constant.h> +#include <__type_traits/is_assignable.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +template struct _LIBCPP_TEMPLATE_VIS is_copy_assignable + : public is_assignable::type, + typename add_lvalue_reference::type>::type> {}; + +#if _LIBCPP_STD_VER > 14 +template +inline constexpr bool is_copy_assignable_v = is_copy_assignable<_Tp>::value; +#endif + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_IS_COPY_ASSIGNABLE_H diff --git a/libcxx/include/__type_traits/is_core_convertible.h b/libcxx/include/__type_traits/is_core_convertible.h new file mode 100644 --- /dev/null +++ b/libcxx/include/__type_traits/is_core_convertible.h @@ -0,0 +1,36 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCPP___TYPE_TRAITS_IS_CORE_CONVERTIBLE_H +#define _LIBCPP___TYPE_TRAITS_IS_CORE_CONVERTIBLE_H + +#include <__config> +#include <__type_traits/integral_constant.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +// [conv.general]/3 says "E is convertible to T" whenever "T t=E;" is well-formed. +// We can't test for that, but we can test implicit convertibility by passing it +// to a function. Notice that __is_core_convertible is false, +// and __is_core_convertible is true in C++17 and later. + +template +struct __is_core_convertible : public false_type {}; + +template +struct __is_core_convertible<_Tp, _Up, decltype( + static_cast(0) ( static_cast<_Tp(*)()>(0)() ) +)> : public true_type {}; + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_IS_CORE_CONVERTIBLE_H diff --git a/libcxx/include/__type_traits/is_literal_type.h b/libcxx/include/__type_traits/is_literal_type.h new file mode 100644 --- /dev/null +++ b/libcxx/include/__type_traits/is_literal_type.h @@ -0,0 +1,34 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCPP___TYPE_TRAITS_IS_LITERAL_TYPE +#define _LIBCPP___TYPE_TRAITS_IS_LITERAL_TYPE + +#include <__config> +#include <__type_traits/integral_constant.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_TYPE_TRAITS) +template struct _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 is_literal_type + : public integral_constant + {}; + +#if _LIBCPP_STD_VER > 14 +template +_LIBCPP_DEPRECATED_IN_CXX17 inline constexpr bool is_literal_type_v = is_literal_type<_Tp>::value; +#endif // _LIBCPP_STD_VER > 14 +#endif // _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_TYPE_TRAITS) + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_IS_LITERAL_TYPE diff --git a/libcxx/include/__type_traits/is_move_assignable.h b/libcxx/include/__type_traits/is_move_assignable.h new file mode 100644 --- /dev/null +++ b/libcxx/include/__type_traits/is_move_assignable.h @@ -0,0 +1,36 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCPP___TYPE_TRAITS_IS_MOVE_ASSIGNABLE_H +#define _LIBCPP___TYPE_TRAITS_IS_MOVE_ASSIGNABLE_H + +#include <__config> +#include <__type_traits/add_const.h> +#include <__type_traits/add_lvalue_reference.h> +#include <__type_traits/add_rvalue_reference.h> +#include <__type_traits/integral_constant.h> +#include <__type_traits/is_assignable.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +template struct _LIBCPP_TEMPLATE_VIS is_move_assignable + : public is_assignable::type, + typename add_rvalue_reference<_Tp>::type> {}; + +#if _LIBCPP_STD_VER > 14 +template +inline constexpr bool is_move_assignable_v = is_move_assignable<_Tp>::value; +#endif + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_IS_MOVE_ASSIGNABLE_H diff --git a/libcxx/include/__type_traits/is_pod.h b/libcxx/include/__type_traits/is_pod.h new file mode 100644 --- /dev/null +++ b/libcxx/include/__type_traits/is_pod.h @@ -0,0 +1,43 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCPP___TYPE_TRAITS_IS_POD_H +#define _LIBCPP___TYPE_TRAITS_IS_POD_H + +#include <__config> +#include <__type_traits/integral_constant.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +#if __has_feature(is_pod) || defined(_LIBCPP_COMPILER_GCC) + +template struct _LIBCPP_TEMPLATE_VIS is_pod + : public integral_constant {}; + +#else + +template struct _LIBCPP_TEMPLATE_VIS is_pod + : public integral_constant::value && + is_trivially_copy_constructible<_Tp>::value && + is_trivially_copy_assignable<_Tp>::value && + is_trivially_destructible<_Tp>::value> {}; + +#endif + +#if _LIBCPP_STD_VER > 14 +template +inline constexpr bool is_pod_v = is_pod<_Tp>::value; +#endif + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_IS_POD_H diff --git a/libcxx/include/__type_traits/is_polymorphic.h b/libcxx/include/__type_traits/is_polymorphic.h new file mode 100644 --- /dev/null +++ b/libcxx/include/__type_traits/is_polymorphic.h @@ -0,0 +1,46 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCPP___TYPE_TRAITS_IS_POLYMORPHIC_H +#define _LIBCPP___TYPE_TRAITS_IS_POLYMORPHIC_H + +#include <__config> +#include <__type_traits/integral_constant.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +#if __has_feature(is_polymorphic) || defined(_LIBCPP_COMPILER_MSVC) + +template +struct _LIBCPP_TEMPLATE_VIS is_polymorphic + : public integral_constant {}; + +#else + +template char &__is_polymorphic_impl( + typename enable_if(declval<_Tp*>())) != 0, + int>::type); +template __two &__is_polymorphic_impl(...); + +template struct _LIBCPP_TEMPLATE_VIS is_polymorphic + : public integral_constant(0)) == 1> {}; + +#endif // __has_feature(is_polymorphic) + +#if _LIBCPP_STD_VER > 14 +template +inline constexpr bool is_polymorphic_v = is_polymorphic<_Tp>::value; +#endif + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_IS_POLYMORPHIC_H diff --git a/libcxx/include/__type_traits/is_scoped_enum.h b/libcxx/include/__type_traits/is_scoped_enum.h new file mode 100644 --- /dev/null +++ b/libcxx/include/__type_traits/is_scoped_enum.h @@ -0,0 +1,42 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCPP___TYPE_TRAITS_IS_SCOPED_ENUM_H +#define _LIBCPP___TYPE_TRAITS_IS_SCOPED_ENUM_H + +#include <__config> +#include <__type_traits/integral_constant.h> +#include <__type_traits/is_convertible.h> +#include <__type_traits/is_enum.h> +#include <__type_traits/underlying_type.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +#if _LIBCPP_STD_VER > 20 +template > +struct __is_scoped_enum_helper : false_type {}; + +template +struct __is_scoped_enum_helper<_Tp, true> + : public bool_constant > > {}; + +template +struct _LIBCPP_TEMPLATE_VIS is_scoped_enum + : public __is_scoped_enum_helper<_Tp> {}; + +template +inline constexpr bool is_scoped_enum_v = is_scoped_enum<_Tp>::value; +#endif + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_IS_SCOPED_ENUM_H diff --git a/libcxx/include/__type_traits/is_standard_layout.h b/libcxx/include/__type_traits/is_standard_layout.h new file mode 100644 --- /dev/null +++ b/libcxx/include/__type_traits/is_standard_layout.h @@ -0,0 +1,36 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCPP___TYPE_TRAITS_IS_STANDARD_LAYOUT_H +#define _LIBCPP___TYPE_TRAITS_IS_STANDARD_LAYOUT_H + +#include <__config> +#include <__type_traits/integral_constant.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +template struct _LIBCPP_TEMPLATE_VIS is_standard_layout +#if __has_feature(is_standard_layout) || defined(_LIBCPP_COMPILER_GCC) + : public integral_constant +#else + : integral_constant::type>::value> +#endif + {}; + +#if _LIBCPP_STD_VER > 14 +template +inline constexpr bool is_standard_layout_v = is_standard_layout<_Tp>::value; +#endif + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_IS_STANDARD_LAYOUT_H diff --git a/libcxx/include/__type_traits/is_trivial.h b/libcxx/include/__type_traits/is_trivial.h new file mode 100644 --- /dev/null +++ b/libcxx/include/__type_traits/is_trivial.h @@ -0,0 +1,37 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCPP___TYPE_TRAITS_IS_TRIVIAL_H +#define _LIBCPP___TYPE_TRAITS_IS_TRIVIAL_H + +#include <__config> +#include <__type_traits/integral_constant.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +template struct _LIBCPP_TEMPLATE_VIS is_trivial +#if __has_feature(is_trivial) || defined(_LIBCPP_COMPILER_GCC) + : public integral_constant +#else + : integral_constant::value && + is_trivially_default_constructible<_Tp>::value> +#endif + {}; + +#if _LIBCPP_STD_VER > 14 +template +inline constexpr bool is_trivial_v = is_trivial<_Tp>::value; +#endif + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_IS_TRIVIAL_H diff --git a/libcxx/include/__type_traits/is_trivially_copyable.h b/libcxx/include/__type_traits/is_trivially_copyable.h new file mode 100644 --- /dev/null +++ b/libcxx/include/__type_traits/is_trivially_copyable.h @@ -0,0 +1,32 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCPP___TYPE_TRAITS_IS_TRIVIALLY_COPYABLE_H +#define _LIBCPP___TYPE_TRAITS_IS_TRIVIALLY_COPYABLE_H + +#include <__config> +#include <__type_traits/integral_constant.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +template struct _LIBCPP_TEMPLATE_VIS is_trivially_copyable + : public integral_constant + {}; + +#if _LIBCPP_STD_VER > 14 +template +inline constexpr bool is_trivially_copyable_v = is_trivially_copyable<_Tp>::value; +#endif + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_IS_TRIVIALLY_COPYABLE_H diff --git a/libcxx/include/__type_traits/underlying_type.h b/libcxx/include/__type_traits/underlying_type.h new file mode 100644 --- /dev/null +++ b/libcxx/include/__type_traits/underlying_type.h @@ -0,0 +1,41 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCPP___TYPE_TRAITS_UNDERLYING_TYPE_H +#define _LIBCPP___TYPE_TRAITS_UNDERLYING_TYPE_H + +#include <__config> +#include <__type_traits/is_enum.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +template ::value> struct __underlying_type_impl; + +template +struct __underlying_type_impl<_Tp, false> {}; + +template +struct __underlying_type_impl<_Tp, true> +{ + typedef __underlying_type(_Tp) type; +}; + +template +struct underlying_type : __underlying_type_impl<_Tp, is_enum<_Tp>::value> {}; + +#if _LIBCPP_STD_VER > 11 +template using underlying_type_t = typename underlying_type<_Tp>::type; +#endif + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_UNDERLYING_TYPE_H diff --git a/libcxx/include/__utility/forward.h b/libcxx/include/__utility/forward.h --- a/libcxx/include/__utility/forward.h +++ b/libcxx/include/__utility/forward.h @@ -11,7 +11,8 @@ #define _LIBCPP___UTILITY_FORWARD_H #include <__config> -#include +#include <__type_traits/is_reference.h> +#include <__type_traits/remove_reference.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header diff --git a/libcxx/include/module.modulemap b/libcxx/include/module.modulemap --- a/libcxx/include/module.modulemap +++ b/libcxx/include/module.modulemap @@ -987,61 +987,77 @@ export functional.__functional.unwrap_ref export * - module add_const { private header "__type_traits/add_const.h" } - module add_cv { private header "__type_traits/add_cv.h" } - module add_lvalue_reference { private header "__type_traits/add_lvalue_reference.h" } - module add_pointer { private header "__type_traits/add_pointer.h" } - module add_rvalue_reference { private header "__type_traits/add_rvalue_reference.h" } - module add_volatile { private header "__type_traits/add_volatile.h" } - module conditional { private header "__type_traits/conditional.h" } - module decay { private header "__type_traits/decay.h" } - module enable_if { private header "__type_traits/enable_if.h" } - module extent { private header "__type_traits/extent.h" } - module integral_constant { private header "__type_traits/integral_constant.h" } - module is_abstract { private header "__type_traits/is_abstract.h" } - module is_aggregate { private header "__type_traits/is_aggregate.h" } - module is_arithmetic { private header "__type_traits/is_arithmetic.h" } - module is_array { private header "__type_traits/is_array.h" } - module is_base_of { private header "__type_traits/is_base_of.h" } - module is_bounded_array { private header "__type_traits/is_bounded_array.h" } - module is_callable { private header "__type_traits/is_callable.h" } - module is_class { private header "__type_traits/is_class.h" } - module is_compound { private header "__type_traits/is_compound.h" } - module is_const { private header "__type_traits/is_const.h" } - module is_convertible { private header "__type_traits/is_convertible.h" } - module is_empty { private header "__type_traits/is_empty.h" } - module is_enum { private header "__type_traits/is_enum.h" } - module is_final { private header "__type_traits/is_final.h" } - module is_floating_point { private header "__type_traits/is_floating_point.h" } - module is_function { private header "__type_traits/is_function.h" } - module is_fundamental { private header "__type_traits/is_fundamental.h" } - module is_integral { private header "__type_traits/is_integral.h" } - module is_member_function_pointer { private header "__type_traits/is_member_function_pointer.h" } - module is_member_object_pointer { private header "__type_traits/is_member_object_pointer.h" } - module is_member_pointer { private header "__type_traits/is_member_pointer.h" } - module is_null_pointer { private header "__type_traits/is_null_pointer.h" } - module is_object { private header "__type_traits/is_object.h" } - module is_pointer { private header "__type_traits/is_pointer.h" } - module is_reference { private header "__type_traits/is_reference.h" } - module is_reference_wrapper { private header "__type_traits/is_reference_wrapper.h" } - module is_referenceable { private header "__type_traits/is_referenceable.h" } - module is_same { private header "__type_traits/is_same.h" } - module is_scalar { private header "__type_traits/is_scalar.h" } - module is_signed { private header "__type_traits/is_signed.h" } - module is_unbounded_array { private header "__type_traits/is_unbounded_array.h" } - module is_union { private header "__type_traits/is_union.h" } - module is_unsigned { private header "__type_traits/is_unsigned.h" } - module is_void { private header "__type_traits/is_void.h" } - module is_volatile { private header "__type_traits/is_volatile.h" } - module rank { private header "__type_traits/rank.h" } - module remove_all_extents { private header "__type_traits/remove_all_extents.h" } - module remove_const { private header "__type_traits/remove_const.h" } - module remove_cv { private header "__type_traits/remove_cv.h" } - module remove_extent { private header "__type_traits/remove_extent.h" } - module remove_pointer { private header "__type_traits/remove_pointer.h" } - module remove_reference { private header "__type_traits/remove_reference.h" } - module remove_volatile { private header "__type_traits/remove_volatile.h" } - module type_identity { private header "__type_traits/type_identity.h" } + module alignment_of { private header "__type_traits/alignment_of.h" } + module add_const { private header "__type_traits/add_const.h" } + module add_cv { private header "__type_traits/add_cv.h" } + module add_lvalue_reference { private header "__type_traits/add_lvalue_reference.h" } + module add_pointer { private header "__type_traits/add_pointer.h" } + module add_rvalue_reference { private header "__type_traits/add_rvalue_reference.h" } + module add_volatile { private header "__type_traits/add_volatile.h" } + module conditional { private header "__type_traits/conditional.h" } + module decay { private header "__type_traits/decay.h" } + module enable_if { private header "__type_traits/enable_if.h" } + module extent { private header "__type_traits/extent.h" } + module has_unique_object_representation { private header "__type_traits/has_unique_object_representation.h" } + module has_virtual_destructor { private header "__type_traits/has_virtual_destructor.h" } + module integral_constant { private header "__type_traits/integral_constant.h" } + module is_abstract { private header "__type_traits/is_abstract.h" } + module is_aggregate { private header "__type_traits/is_aggregate.h" } + module is_assignable { private header "__type_traits/is_assignable.h" } + module is_arithmetic { private header "__type_traits/is_arithmetic.h" } + module is_array { private header "__type_traits/is_array.h" } + module is_base_of { private header "__type_traits/is_base_of.h" } + module is_bounded_array { private header "__type_traits/is_bounded_array.h" } + module is_callable { private header "__type_traits/is_callable.h" } + module is_constant_evaluated { private header "__type_traits/is_constant_evaluated.h" } + module is_copy_assignable { private header "__type_traits/is_copy_assignable.h" } + module is_core_convertible { private header "__type_traits/is_core_convertible.h" } + module is_class { private header "__type_traits/is_class.h" } + module is_compound { private header "__type_traits/is_compound.h" } + module is_const { private header "__type_traits/is_const.h" } + module is_convertible { private header "__type_traits/is_convertible.h" } + module is_empty { private header "__type_traits/is_empty.h" } + module is_enum { private header "__type_traits/is_enum.h" } + module is_final { private header "__type_traits/is_final.h" } + module is_floating_point { private header "__type_traits/is_floating_point.h" } + module is_function { private header "__type_traits/is_function.h" } + module is_fundamental { private header "__type_traits/is_fundamental.h" } + module is_integral { private header "__type_traits/is_integral.h" } + module is_literal_type { private header "__type_traits/is_literal_type.h" } + module is_member_function_pointer { private header "__type_traits/is_member_function_pointer.h" } + module is_member_object_pointer { private header "__type_traits/is_member_object_pointer.h" } + module is_member_pointer { private header "__type_traits/is_member_pointer.h" } + module is_move_assignable { private header "__type_traits/is_move_assignable.h" } + module is_null_pointer { private header "__type_traits/is_null_pointer.h" } + module is_object { private header "__type_traits/is_object.h" } + module is_pod { private header "__type_traits/is_pod.h" } + module is_polymorphic { private header "__type_traits/is_polymorphic.h" } + module is_pointer { private header "__type_traits/is_pointer.h" } + module is_reference { private header "__type_traits/is_reference.h" } + module is_reference_wrapper { private header "__type_traits/is_reference_wrapper.h" } + module is_referenceable { private header "__type_traits/is_referenceable.h" } + module is_same { private header "__type_traits/is_same.h" } + module is_scalar { private header "__type_traits/is_scalar.h" } + module is_scoped_enum { private header "__type_traits/is_scoped_enum.h" } + module is_signed { private header "__type_traits/is_signed.h" } + module is_standard_layout { private header "__type_traits/is_standard_layout.h" } + module is_trivial { private header "__type_traits/is_trivial.h" } + module is_trivially_copyable { private header "__type_traits/is_trivially_copyable.h" } + module is_unbounded_array { private header "__type_traits/is_unbounded_array.h" } + module is_union { private header "__type_traits/is_union.h" } + module is_unsigned { private header "__type_traits/is_unsigned.h" } + module is_void { private header "__type_traits/is_void.h" } + module is_volatile { private header "__type_traits/is_volatile.h" } + module rank { private header "__type_traits/rank.h" } + module remove_all_extents { private header "__type_traits/remove_all_extents.h" } + module remove_const { private header "__type_traits/remove_const.h" } + module remove_cv { private header "__type_traits/remove_cv.h" } + module remove_extent { private header "__type_traits/remove_extent.h" } + module remove_pointer { private header "__type_traits/remove_pointer.h" } + module remove_reference { private header "__type_traits/remove_reference.h" } + module remove_volatile { private header "__type_traits/remove_volatile.h" } + module type_identity { private header "__type_traits/type_identity.h" } + module underlying_type { private header "__type_traits/underlying_type.h" } } module typeindex { header "typeindex" diff --git a/libcxx/include/type_traits b/libcxx/include/type_traits --- a/libcxx/include/type_traits +++ b/libcxx/include/type_traits @@ -418,28 +418,35 @@ */ #include <__assert> // all public C++ headers provide the assertion handler #include <__config> +#include <__functional/invoke.h> #include <__type_traits/add_const.h> #include <__type_traits/add_cv.h> #include <__type_traits/add_lvalue_reference.h> #include <__type_traits/add_pointer.h> #include <__type_traits/add_rvalue_reference.h> #include <__type_traits/add_volatile.h> +#include <__type_traits/alignment_of.h> #include <__type_traits/conditional.h> #include <__type_traits/decay.h> #include <__type_traits/enable_if.h> #include <__type_traits/extent.h> +#include <__type_traits/has_unique_object_representation.h> +#include <__type_traits/has_virtual_destructor.h> #include <__type_traits/integral_constant.h> #include <__type_traits/is_abstract.h> #include <__type_traits/is_aggregate.h> #include <__type_traits/is_arithmetic.h> #include <__type_traits/is_array.h> +#include <__type_traits/is_assignable.h> #include <__type_traits/is_base_of.h> #include <__type_traits/is_bounded_array.h> #include <__type_traits/is_callable.h> #include <__type_traits/is_class.h> #include <__type_traits/is_compound.h> #include <__type_traits/is_const.h> +#include <__type_traits/is_constant_evaluated.h> #include <__type_traits/is_convertible.h> +#include <__type_traits/is_copy_assignable.h> #include <__type_traits/is_empty.h> #include <__type_traits/is_enum.h> #include <__type_traits/is_final.h> @@ -447,18 +454,26 @@ #include <__type_traits/is_function.h> #include <__type_traits/is_fundamental.h> #include <__type_traits/is_integral.h> +#include <__type_traits/is_literal_type.h> #include <__type_traits/is_member_function_pointer.h> #include <__type_traits/is_member_object_pointer.h> #include <__type_traits/is_member_pointer.h> +#include <__type_traits/is_move_assignable.h> #include <__type_traits/is_null_pointer.h> #include <__type_traits/is_object.h> +#include <__type_traits/is_pod.h> #include <__type_traits/is_pointer.h> +#include <__type_traits/is_polymorphic.h> #include <__type_traits/is_reference.h> #include <__type_traits/is_reference_wrapper.h> #include <__type_traits/is_referenceable.h> #include <__type_traits/is_same.h> #include <__type_traits/is_scalar.h> +#include <__type_traits/is_scoped_enum.h> #include <__type_traits/is_signed.h> +#include <__type_traits/is_standard_layout.h> +#include <__type_traits/is_trivial.h> +#include <__type_traits/is_trivially_copyable.h> #include <__type_traits/is_unbounded_array.h> #include <__type_traits/is_union.h> #include <__type_traits/is_unsigned.h> @@ -473,6 +488,7 @@ #include <__type_traits/remove_reference.h> #include <__type_traits/remove_volatile.h> #include <__type_traits/type_identity.h> +#include <__type_traits/underlying_type.h> #include <__utility/declval.h> #include #include @@ -609,27 +625,6 @@ template using remove_cvref_t = typename remove_cvref<_Tp>::type; #endif - -struct __any -{ - __any(...); -}; - -// __is_core_convertible - -// [conv.general]/3 says "E is convertible to T" whenever "T t=E;" is well-formed. -// We can't test for that, but we can test implicit convertibility by passing it -// to a function. Notice that __is_core_convertible is false, -// and __is_core_convertible is true in C++17 and later. - -template -struct __is_core_convertible : public false_type {}; - -template -struct __is_core_convertible<_Tp, _Up, decltype( - static_cast(0) ( static_cast<_Tp(*)()>(0)() ) -)> : public true_type {}; - // is_nothrow_convertible #if _LIBCPP_STD_VER > 17 @@ -656,73 +651,6 @@ #endif // _LIBCPP_STD_VER > 17 -// is_polymorphic - -#if __has_feature(is_polymorphic) || defined(_LIBCPP_COMPILER_MSVC) - -template -struct _LIBCPP_TEMPLATE_VIS is_polymorphic - : public integral_constant {}; - -#else - -template char &__is_polymorphic_impl( - typename enable_if(declval<_Tp*>())) != 0, - int>::type); -template __two &__is_polymorphic_impl(...); - -template struct _LIBCPP_TEMPLATE_VIS is_polymorphic - : public integral_constant(0)) == 1> {}; - -#endif // __has_feature(is_polymorphic) - -#if _LIBCPP_STD_VER > 14 -template -inline constexpr bool is_polymorphic_v = is_polymorphic<_Tp>::value; -#endif - -// has_virtual_destructor - -#if __has_feature(has_virtual_destructor) || defined(_LIBCPP_COMPILER_GCC) - -template struct _LIBCPP_TEMPLATE_VIS has_virtual_destructor - : public integral_constant {}; - -#else - -template struct _LIBCPP_TEMPLATE_VIS has_virtual_destructor - : public false_type {}; - -#endif - -#if _LIBCPP_STD_VER > 14 -template -inline constexpr bool has_virtual_destructor_v = has_virtual_destructor<_Tp>::value; -#endif - -// has_unique_object_representations - -#if _LIBCPP_STD_VER > 14 - -template struct _LIBCPP_TEMPLATE_VIS has_unique_object_representations - : public integral_constant>)> {}; - -template -inline constexpr bool has_unique_object_representations_v = has_unique_object_representations<_Tp>::value; - -#endif - -// alignment_of - -template struct _LIBCPP_TEMPLATE_VIS alignment_of - : public integral_constant {}; - -#if _LIBCPP_STD_VER > 14 -template -inline constexpr size_t alignment_of_v = alignment_of<_Tp>::value; -#endif - // aligned_storage template @@ -732,16 +660,6 @@ typedef _Tp _Tail; }; -struct __nat -{ -#ifndef _LIBCPP_CXX03_LANG - __nat() = delete; - __nat(const __nat&) = delete; - __nat& operator=(const __nat&) = delete; - ~__nat() = delete; -#endif -}; - template struct __align_type { @@ -1454,73 +1372,6 @@ #endif // _LIBCPP_STD_VER > 17 -// is_assignable - -template struct __select_2nd { typedef _LIBCPP_NODEBUG _Tp type; }; - -#if __has_keyword(__is_assignable) - -template -struct _LIBCPP_TEMPLATE_VIS is_assignable : _BoolConstant<__is_assignable(_Tp, _Up)> { }; - -#if _LIBCPP_STD_VER > 14 -template -inline constexpr bool is_assignable_v = __is_assignable(_Tp, _Arg); -#endif - -#else // __has_keyword(__is_assignable) - -template -typename __select_2nd() = declval<_Arg>())), true_type>::type -__is_assignable_test(int); - -template -false_type __is_assignable_test(...); - - -template ::value || is_void<_Arg>::value> -struct __is_assignable_imp - : public decltype((_VSTD::__is_assignable_test<_Tp, _Arg>(0))) {}; - -template -struct __is_assignable_imp<_Tp, _Arg, true> - : public false_type -{ -}; - -template -struct is_assignable - : public __is_assignable_imp<_Tp, _Arg> {}; - -#if _LIBCPP_STD_VER > 14 -template -inline constexpr bool is_assignable_v = is_assignable<_Tp, _Arg>::value; -#endif - -#endif // __has_keyword(__is_assignable) - -// is_copy_assignable - -template struct _LIBCPP_TEMPLATE_VIS is_copy_assignable - : public is_assignable::type, - typename add_lvalue_reference::type>::type> {}; - -#if _LIBCPP_STD_VER > 14 -template -inline constexpr bool is_copy_assignable_v = is_copy_assignable<_Tp>::value; -#endif - -// is_move_assignable - -template struct _LIBCPP_TEMPLATE_VIS is_move_assignable - : public is_assignable::type, - typename add_rvalue_reference<_Tp>::type> {}; - -#if _LIBCPP_STD_VER > 14 -template -inline constexpr bool is_move_assignable_v = is_move_assignable<_Tp>::value; -#endif - // is_destructible #if __has_keyword(__is_destructible) @@ -1818,15 +1669,6 @@ // typedef ... _FnType; }; - -template -struct __member_pointer_class_type {}; - -template -struct __member_pointer_class_type<_Ret _ClassType::*> { - typedef _ClassType type; -}; - // template struct is_constructible; template @@ -2219,302 +2061,6 @@ inline constexpr bool is_nothrow_destructible_v = is_nothrow_destructible<_Tp>::value; #endif -// is_pod - -#if __has_feature(is_pod) || defined(_LIBCPP_COMPILER_GCC) - -template struct _LIBCPP_TEMPLATE_VIS is_pod - : public integral_constant {}; - -#else - -template struct _LIBCPP_TEMPLATE_VIS is_pod - : public integral_constant::value && - is_trivially_copy_constructible<_Tp>::value && - is_trivially_copy_assignable<_Tp>::value && - is_trivially_destructible<_Tp>::value> {}; - -#endif - -#if _LIBCPP_STD_VER > 14 -template -inline constexpr bool is_pod_v = is_pod<_Tp>::value; -#endif - -// is_literal_type; - -#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_TYPE_TRAITS) -template struct _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 is_literal_type - : public integral_constant - {}; - -#if _LIBCPP_STD_VER > 14 -template -_LIBCPP_DEPRECATED_IN_CXX17 inline constexpr bool is_literal_type_v = is_literal_type<_Tp>::value; -#endif // _LIBCPP_STD_VER > 14 -#endif // _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_TYPE_TRAITS) - -// is_standard_layout; - -template struct _LIBCPP_TEMPLATE_VIS is_standard_layout -#if __has_feature(is_standard_layout) || defined(_LIBCPP_COMPILER_GCC) - : public integral_constant -#else - : integral_constant::type>::value> -#endif - {}; - -#if _LIBCPP_STD_VER > 14 -template -inline constexpr bool is_standard_layout_v = is_standard_layout<_Tp>::value; -#endif - -// is_trivially_copyable; - -template struct _LIBCPP_TEMPLATE_VIS is_trivially_copyable - : public integral_constant - {}; - -#if _LIBCPP_STD_VER > 14 -template -inline constexpr bool is_trivially_copyable_v = is_trivially_copyable<_Tp>::value; -#endif - -// is_trivial; - -template struct _LIBCPP_TEMPLATE_VIS is_trivial -#if __has_feature(is_trivial) || defined(_LIBCPP_COMPILER_GCC) - : public integral_constant -#else - : integral_constant::value && - is_trivially_default_constructible<_Tp>::value> -#endif - {}; - -#if _LIBCPP_STD_VER > 14 -template -inline constexpr bool is_trivial_v = is_trivial<_Tp>::value; -#endif - - -#ifndef _LIBCPP_CXX03_LANG - -template ::type, - class _DecayA0 = typename decay<_A0>::type, - class _ClassT = typename __member_pointer_class_type<_DecayFp>::type> -using __enable_if_bullet1 = typename enable_if - < - is_member_function_pointer<_DecayFp>::value - && is_base_of<_ClassT, _DecayA0>::value - >::type; - -template ::type, - class _DecayA0 = typename decay<_A0>::type> -using __enable_if_bullet2 = typename enable_if - < - is_member_function_pointer<_DecayFp>::value - && __is_reference_wrapper<_DecayA0>::value - >::type; - -template ::type, - class _DecayA0 = typename decay<_A0>::type, - class _ClassT = typename __member_pointer_class_type<_DecayFp>::type> -using __enable_if_bullet3 = typename enable_if - < - is_member_function_pointer<_DecayFp>::value - && !is_base_of<_ClassT, _DecayA0>::value - && !__is_reference_wrapper<_DecayA0>::value - >::type; - -template ::type, - class _DecayA0 = typename decay<_A0>::type, - class _ClassT = typename __member_pointer_class_type<_DecayFp>::type> -using __enable_if_bullet4 = typename enable_if - < - is_member_object_pointer<_DecayFp>::value - && is_base_of<_ClassT, _DecayA0>::value - >::type; - -template ::type, - class _DecayA0 = typename decay<_A0>::type> -using __enable_if_bullet5 = typename enable_if - < - is_member_object_pointer<_DecayFp>::value - && __is_reference_wrapper<_DecayA0>::value - >::type; - -template ::type, - class _DecayA0 = typename decay<_A0>::type, - class _ClassT = typename __member_pointer_class_type<_DecayFp>::type> -using __enable_if_bullet6 = typename enable_if - < - is_member_object_pointer<_DecayFp>::value - && !is_base_of<_ClassT, _DecayA0>::value - && !__is_reference_wrapper<_DecayA0>::value - >::type; - -// __invoke forward declarations - -// fall back - none of the bullets - -template -auto __invoke(__any, _Args&& ...__args) -> __nat; - -// bullets 1, 2 and 3 - -template > -inline _LIBCPP_INLINE_VISIBILITY -constexpr auto -__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args) - noexcept(noexcept((static_cast<_A0&&>(__a0).*__f)(static_cast<_Args&&>(__args)...))) - -> decltype( (static_cast<_A0&&>(__a0).*__f)(static_cast<_Args&&>(__args)...)) - { return (static_cast<_A0&&>(__a0).*__f)(static_cast<_Args&&>(__args)...); } - -template > -inline _LIBCPP_INLINE_VISIBILITY -constexpr auto -__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args) - noexcept(noexcept((__a0.get().*__f)(static_cast<_Args&&>(__args)...))) - -> decltype( (__a0.get().*__f)(static_cast<_Args&&>(__args)...)) - { return (__a0.get().*__f)(static_cast<_Args&&>(__args)...); } - -template > -inline _LIBCPP_INLINE_VISIBILITY -constexpr auto -__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args) - noexcept(noexcept(((*static_cast<_A0&&>(__a0)).*__f)(static_cast<_Args&&>(__args)...))) - -> decltype( ((*static_cast<_A0&&>(__a0)).*__f)(static_cast<_Args&&>(__args)...)) - { return ((*static_cast<_A0&&>(__a0)).*__f)(static_cast<_Args&&>(__args)...); } - -// bullets 4, 5 and 6 - -template > -inline _LIBCPP_INLINE_VISIBILITY -constexpr auto -__invoke(_Fp&& __f, _A0&& __a0) - noexcept(noexcept(static_cast<_A0&&>(__a0).*__f)) - -> decltype( static_cast<_A0&&>(__a0).*__f) - { return static_cast<_A0&&>(__a0).*__f; } - -template > -inline _LIBCPP_INLINE_VISIBILITY -constexpr auto -__invoke(_Fp&& __f, _A0&& __a0) - noexcept(noexcept(__a0.get().*__f)) - -> decltype( __a0.get().*__f) - { return __a0.get().*__f; } - -template > -inline _LIBCPP_INLINE_VISIBILITY -constexpr auto -__invoke(_Fp&& __f, _A0&& __a0) - noexcept(noexcept((*static_cast<_A0&&>(__a0)).*__f)) - -> decltype( (*static_cast<_A0&&>(__a0)).*__f) - { return (*static_cast<_A0&&>(__a0)).*__f; } - -// bullet 7 - -template -inline _LIBCPP_INLINE_VISIBILITY -constexpr auto -__invoke(_Fp&& __f, _Args&& ...__args) - noexcept(noexcept(static_cast<_Fp&&>(__f)(static_cast<_Args&&>(__args)...))) - -> decltype( static_cast<_Fp&&>(__f)(static_cast<_Args&&>(__args)...)) - { return static_cast<_Fp&&>(__f)(static_cast<_Args&&>(__args)...); } - -// __invokable -template -struct __invokable_r -{ - template - static auto __try_call(int) -> decltype( - _VSTD::__invoke(declval<_XFp>(), declval<_XArgs>()...)); - template - static __nat __try_call(...); - - // FIXME: Check that _Ret, _Fp, and _Args... are all complete types, cv void, - // or incomplete array types as required by the standard. - using _Result = decltype(__try_call<_Fp, _Args...>(0)); - - using type = typename conditional< - _IsNotSame<_Result, __nat>::value, - typename conditional< is_void<_Ret>::value, true_type, __is_core_convertible<_Result, _Ret> >::type, - false_type >::type; - static const bool value = type::value; -}; -template -using __invokable = __invokable_r; - -template -struct __nothrow_invokable_r_imp { - static const bool value = false; -}; - -template -struct __nothrow_invokable_r_imp -{ - typedef __nothrow_invokable_r_imp _ThisT; - - template - static void __test_noexcept(_Tp) noexcept; - - static const bool value = noexcept(_ThisT::__test_noexcept<_Ret>( - _VSTD::__invoke(declval<_Fp>(), declval<_Args>()...))); -}; - -template -struct __nothrow_invokable_r_imp -{ - static const bool value = noexcept( - _VSTD::__invoke(declval<_Fp>(), declval<_Args>()...)); -}; - -template -using __nothrow_invokable_r = - __nothrow_invokable_r_imp< - __invokable_r<_Ret, _Fp, _Args...>::value, - is_void<_Ret>::value, - _Ret, _Fp, _Args... - >; - -template -using __nothrow_invokable = - __nothrow_invokable_r_imp< - __invokable<_Fp, _Args...>::value, - true, void, _Fp, _Args... - >; - -template -struct __invoke_of - : public enable_if< - __invokable<_Fp, _Args...>::value, - typename __invokable_r::_Result> -{ -}; - -#else - -// Assume that it's a functor in C++03 -template -_LIBCPP_HIDE_FROM_ABI -decltype(std::declval<_Func>()(std::declval<_Args>()...)) __invoke(_Func&& __func, _Args&&... __args) { - return static_cast<_Func&&>(__func)(static_cast<_Args&&>(__args)...); -} - -#endif // _LIBCPP_CXX03_LANG - // result_of #if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_TYPE_TRAITS) @@ -2610,53 +2156,6 @@ #endif // _LIBCPP_STD_VER > 11 #endif // _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_TYPE_TRAITS) -#if _LIBCPP_STD_VER > 14 - -// invoke_result - -template -struct _LIBCPP_TEMPLATE_VIS invoke_result - : __invoke_of<_Fn, _Args...> -{ -}; - -template -using invoke_result_t = typename invoke_result<_Fn, _Args...>::type; - -// is_invocable - -template -struct _LIBCPP_TEMPLATE_VIS is_invocable - : integral_constant::value> {}; - -template -struct _LIBCPP_TEMPLATE_VIS is_invocable_r - : integral_constant::value> {}; - -template -inline constexpr bool is_invocable_v = is_invocable<_Fn, _Args...>::value; - -template -inline constexpr bool is_invocable_r_v = is_invocable_r<_Ret, _Fn, _Args...>::value; - -// is_nothrow_invocable - -template -struct _LIBCPP_TEMPLATE_VIS is_nothrow_invocable - : integral_constant::value> {}; - -template -struct _LIBCPP_TEMPLATE_VIS is_nothrow_invocable_r - : integral_constant::value> {}; - -template -inline constexpr bool is_nothrow_invocable_v = is_nothrow_invocable<_Fn, _Args...>::value; - -template -inline constexpr bool is_nothrow_invocable_r_v = is_nothrow_invocable_r<_Ret, _Fn, _Args...>::value; - -#endif // _LIBCPP_STD_VER > 14 - // __swappable template struct __is_swappable; @@ -2789,24 +2288,6 @@ #endif // _LIBCPP_STD_VER > 14 -template ::value> struct __underlying_type_impl; - -template -struct __underlying_type_impl<_Tp, false> {}; - -template -struct __underlying_type_impl<_Tp, true> -{ - typedef __underlying_type(_Tp) type; -}; - -template -struct underlying_type : __underlying_type_impl<_Tp, is_enum<_Tp>::value> {}; - -#if _LIBCPP_STD_VER > 11 -template using underlying_type_t = typename underlying_type<_Tp>::type; -#endif - template ::value> struct __sfinae_underlying_type { @@ -2853,24 +2334,6 @@ typename __sfinae_underlying_type<_Tp>::__promoted_type __convert_to_integral(_Tp __val) { return __val; } -// is_scoped_enum [meta.unary.prop] - -#if _LIBCPP_STD_VER > 20 -template > -struct __is_scoped_enum_helper : false_type {}; - -template -struct __is_scoped_enum_helper<_Tp, true> - : public bool_constant > > {}; - -template -struct _LIBCPP_TEMPLATE_VIS is_scoped_enum - : public __is_scoped_enum_helper<_Tp> {}; - -template -inline constexpr bool is_scoped_enum_v = is_scoped_enum<_Tp>::value; -#endif - #if _LIBCPP_STD_VER > 14 template @@ -2919,16 +2382,6 @@ struct __can_extract_map_key<_ValTy, _Key, _Key, _RawValTy> : false_type {}; -#if _LIBCPP_STD_VER > 17 -_LIBCPP_INLINE_VISIBILITY -inline constexpr bool is_constant_evaluated() noexcept { - return __builtin_is_constant_evaluated(); -} -#endif - -inline _LIBCPP_CONSTEXPR -bool __libcpp_is_constant_evaluated() _NOEXCEPT { return __builtin_is_constant_evaluated(); } - template using _IsCharLikeType = _And, is_trivial<_CharT> >; diff --git a/libcxx/include/utility b/libcxx/include/utility --- a/libcxx/include/utility +++ b/libcxx/include/utility @@ -242,6 +242,7 @@ #include <__utility/unreachable.h> #include #include +#include #include #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) diff --git a/libcxx/test/libcxx/private_headers.verify.cpp b/libcxx/test/libcxx/private_headers.verify.cpp --- a/libcxx/test/libcxx/private_headers.verify.cpp +++ b/libcxx/test/libcxx/private_headers.verify.cpp @@ -456,22 +456,29 @@ #include <__type_traits/add_pointer.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/add_pointer.h'}} #include <__type_traits/add_rvalue_reference.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/add_rvalue_reference.h'}} #include <__type_traits/add_volatile.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/add_volatile.h'}} +#include <__type_traits/alignment_of.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/alignment_of.h'}} #include <__type_traits/conditional.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/conditional.h'}} #include <__type_traits/decay.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/decay.h'}} #include <__type_traits/enable_if.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/enable_if.h'}} #include <__type_traits/extent.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/extent.h'}} +#include <__type_traits/has_unique_object_representation.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/has_unique_object_representation.h'}} +#include <__type_traits/has_virtual_destructor.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/has_virtual_destructor.h'}} #include <__type_traits/integral_constant.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/integral_constant.h'}} #include <__type_traits/is_abstract.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_abstract.h'}} #include <__type_traits/is_aggregate.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_aggregate.h'}} #include <__type_traits/is_arithmetic.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_arithmetic.h'}} #include <__type_traits/is_array.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_array.h'}} +#include <__type_traits/is_assignable.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_assignable.h'}} #include <__type_traits/is_base_of.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_base_of.h'}} #include <__type_traits/is_bounded_array.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_bounded_array.h'}} #include <__type_traits/is_callable.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_callable.h'}} #include <__type_traits/is_class.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_class.h'}} #include <__type_traits/is_compound.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_compound.h'}} #include <__type_traits/is_const.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_const.h'}} +#include <__type_traits/is_constant_evaluated.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_constant_evaluated.h'}} #include <__type_traits/is_convertible.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_convertible.h'}} +#include <__type_traits/is_copy_assignable.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_copy_assignable.h'}} +#include <__type_traits/is_core_convertible.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_core_convertible.h'}} #include <__type_traits/is_empty.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_empty.h'}} #include <__type_traits/is_enum.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_enum.h'}} #include <__type_traits/is_final.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_final.h'}} @@ -479,18 +486,26 @@ #include <__type_traits/is_function.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_function.h'}} #include <__type_traits/is_fundamental.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_fundamental.h'}} #include <__type_traits/is_integral.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_integral.h'}} +#include <__type_traits/is_literal_type.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_literal_type.h'}} #include <__type_traits/is_member_function_pointer.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_member_function_pointer.h'}} #include <__type_traits/is_member_object_pointer.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_member_object_pointer.h'}} #include <__type_traits/is_member_pointer.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_member_pointer.h'}} +#include <__type_traits/is_move_assignable.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_move_assignable.h'}} #include <__type_traits/is_null_pointer.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_null_pointer.h'}} #include <__type_traits/is_object.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_object.h'}} +#include <__type_traits/is_pod.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_pod.h'}} #include <__type_traits/is_pointer.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_pointer.h'}} +#include <__type_traits/is_polymorphic.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_polymorphic.h'}} #include <__type_traits/is_reference.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_reference.h'}} #include <__type_traits/is_reference_wrapper.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_reference_wrapper.h'}} #include <__type_traits/is_referenceable.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_referenceable.h'}} #include <__type_traits/is_same.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_same.h'}} #include <__type_traits/is_scalar.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_scalar.h'}} +#include <__type_traits/is_scoped_enum.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_scoped_enum.h'}} #include <__type_traits/is_signed.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_signed.h'}} +#include <__type_traits/is_standard_layout.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_standard_layout.h'}} +#include <__type_traits/is_trivial.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_trivial.h'}} +#include <__type_traits/is_trivially_copyable.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_trivially_copyable.h'}} #include <__type_traits/is_unbounded_array.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_unbounded_array.h'}} #include <__type_traits/is_union.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_union.h'}} #include <__type_traits/is_unsigned.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_unsigned.h'}} @@ -505,6 +520,7 @@ #include <__type_traits/remove_reference.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/remove_reference.h'}} #include <__type_traits/remove_volatile.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/remove_volatile.h'}} #include <__type_traits/type_identity.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/type_identity.h'}} +#include <__type_traits/underlying_type.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/underlying_type.h'}} #include <__utility/as_const.h> // expected-error@*:* {{use of private header from outside its module: '__utility/as_const.h'}} #include <__utility/auto_cast.h> // expected-error@*:* {{use of private header from outside its module: '__utility/auto_cast.h'}} #include <__utility/cmp.h> // expected-error@*:* {{use of private header from outside its module: '__utility/cmp.h'}} diff --git a/libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/underlying_type.fail.cpp b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/underlying_type.fail.cpp --- a/libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/underlying_type.fail.cpp +++ b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/underlying_type.fail.cpp @@ -20,7 +20,7 @@ #include "test_macros.h" -enum E1 { E1Zero, E1One, E1Two = sizeof(std::underlying_type::type) }; // expected-error@type_traits:* {{cannot determine underlying type of incomplete enumeration type 'E1'}} +enum E1 { E1Zero, E1One, E1Two = sizeof(std::underlying_type::type) }; // expected-error@*:* {{cannot determine underlying type of incomplete enumeration type 'E1'}} // None of these are incomplete. // Scoped enums have an underlying type of 'int' unless otherwise specified