diff --git a/libcxx/include/CMakeLists.txt b/libcxx/include/CMakeLists.txt --- a/libcxx/include/CMakeLists.txt +++ b/libcxx/include/CMakeLists.txt @@ -324,6 +324,8 @@ __functional/unary_negate.h __functional/unwrap_ref.h __functional/weak_result_type.h + __fwd/hash.h + __fwd/pair.h __fwd/span.h __fwd/string_view.h __hash_table @@ -509,6 +511,7 @@ __type_traits/aligned_union.h __type_traits/alignment_of.h __type_traits/apply_cv.h + __type_traits/can_extract_key.h __type_traits/common_reference.h __type_traits/common_type.h __type_traits/conditional.h @@ -516,6 +519,7 @@ __type_traits/copy_cv.h __type_traits/copy_cvref.h __type_traits/decay.h + __type_traits/dependent_type.h __type_traits/disjunction.h __type_traits/enable_if.h __type_traits/extent.h @@ -530,6 +534,7 @@ __type_traits/is_base_of.h __type_traits/is_bounded_array.h __type_traits/is_callable.h + __type_traits/is_char_like_type.h __type_traits/is_class.h __type_traits/is_compound.h __type_traits/is_const.h @@ -547,6 +552,7 @@ __type_traits/is_floating_point.h __type_traits/is_function.h __type_traits/is_fundamental.h + __type_traits/is_implicitly_default_constructible.h __type_traits/is_integral.h __type_traits/is_literal_type.h __type_traits/is_member_function_pointer.h @@ -578,6 +584,7 @@ __type_traits/is_signed.h __type_traits/is_signed_integer.h __type_traits/is_standard_layout.h + __type_traits/is_swappable.h __type_traits/is_trivial.h __type_traits/is_trivially_assignable.h __type_traits/is_trivially_constructible.h @@ -597,20 +604,24 @@ __type_traits/is_volatile.h __type_traits/lazy.h __type_traits/make_32_64_or_128_bit.h + __type_traits/make_const_lvalue_ref.h __type_traits/make_signed.h __type_traits/make_unsigned.h + __type_traits/maybe_const.h __type_traits/nat.h __type_traits/negation.h __type_traits/promote.h __type_traits/rank.h __type_traits/remove_all_extents.h __type_traits/remove_const.h + __type_traits/remove_const_ref.h __type_traits/remove_cv.h __type_traits/remove_cvref.h __type_traits/remove_extent.h __type_traits/remove_pointer.h __type_traits/remove_reference.h __type_traits/remove_volatile.h + __type_traits/result_of.h __type_traits/type_identity.h __type_traits/type_list.h __type_traits/underlying_type.h @@ -619,6 +630,7 @@ __utility/as_const.h __utility/auto_cast.h __utility/cmp.h + __utility/convert_to_integral.h __utility/declval.h __utility/exchange.h __utility/forward.h diff --git a/libcxx/include/__algorithm/copy_n.h b/libcxx/include/__algorithm/copy_n.h --- a/libcxx/include/__algorithm/copy_n.h +++ b/libcxx/include/__algorithm/copy_n.h @@ -12,6 +12,7 @@ #include <__algorithm/copy.h> #include <__config> #include <__iterator/iterator_traits.h> +#include <__utility/convert_to_integral.h> #include #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) diff --git a/libcxx/include/__algorithm/fill_n.h b/libcxx/include/__algorithm/fill_n.h --- a/libcxx/include/__algorithm/fill_n.h +++ b/libcxx/include/__algorithm/fill_n.h @@ -11,6 +11,7 @@ #include <__config> #include <__iterator/iterator_traits.h> +#include <__utility/convert_to_integral.h> #include #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) diff --git a/libcxx/include/__algorithm/for_each_n.h b/libcxx/include/__algorithm/for_each_n.h --- a/libcxx/include/__algorithm/for_each_n.h +++ b/libcxx/include/__algorithm/for_each_n.h @@ -11,6 +11,7 @@ #define _LIBCPP___ALGORITHM_FOR_EACH_N_H #include <__config> +#include <__utility/convert_to_integral.h> #include #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) diff --git a/libcxx/include/__algorithm/generate_n.h b/libcxx/include/__algorithm/generate_n.h --- a/libcxx/include/__algorithm/generate_n.h +++ b/libcxx/include/__algorithm/generate_n.h @@ -10,6 +10,7 @@ #define _LIBCPP___ALGORITHM_GENERATE_N_H #include <__config> +#include <__utility/convert_to_integral.h> #include #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) diff --git a/libcxx/include/__algorithm/search_n.h b/libcxx/include/__algorithm/search_n.h --- a/libcxx/include/__algorithm/search_n.h +++ b/libcxx/include/__algorithm/search_n.h @@ -19,6 +19,7 @@ #include <__iterator/distance.h> #include <__iterator/iterator_traits.h> #include <__ranges/concepts.h> +#include <__utility/convert_to_integral.h> #include <__utility/pair.h> #include // __convert_to_integral diff --git a/libcxx/include/__compare/compare_three_way_result.h b/libcxx/include/__compare/compare_three_way_result.h --- a/libcxx/include/__compare/compare_three_way_result.h +++ b/libcxx/include/__compare/compare_three_way_result.h @@ -10,6 +10,7 @@ #define _LIBCPP___COMPARE_COMPARE_THREE_WAY_RESULT_H #include <__config> +#include <__type_traits/make_const_lvalue_ref.h> #include #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) diff --git a/libcxx/include/__compare/three_way_comparable.h b/libcxx/include/__compare/three_way_comparable.h --- a/libcxx/include/__compare/three_way_comparable.h +++ b/libcxx/include/__compare/three_way_comparable.h @@ -16,6 +16,7 @@ #include <__concepts/same_as.h> #include <__concepts/totally_ordered.h> #include <__config> +#include <__type_traits/make_const_lvalue_ref.h> #include #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) diff --git a/libcxx/include/__concepts/assignable.h b/libcxx/include/__concepts/assignable.h --- a/libcxx/include/__concepts/assignable.h +++ b/libcxx/include/__concepts/assignable.h @@ -12,6 +12,7 @@ #include <__concepts/common_reference_with.h> #include <__concepts/same_as.h> #include <__config> +#include <__type_traits/make_const_lvalue_ref.h> #include <__utility/forward.h> #include diff --git a/libcxx/include/__concepts/equality_comparable.h b/libcxx/include/__concepts/equality_comparable.h --- a/libcxx/include/__concepts/equality_comparable.h +++ b/libcxx/include/__concepts/equality_comparable.h @@ -12,6 +12,7 @@ #include <__concepts/boolean_testable.h> #include <__concepts/common_reference_with.h> #include <__config> +#include <__type_traits/make_const_lvalue_ref.h> #include #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) diff --git a/libcxx/include/__functional/hash.h b/libcxx/include/__functional/hash.h --- a/libcxx/include/__functional/hash.h +++ b/libcxx/include/__functional/hash.h @@ -11,6 +11,7 @@ #include <__config> #include <__functional/unary_function.h> +#include <__fwd/hash.h> #include <__tuple> #include <__utility/forward.h> #include <__utility/move.h> diff --git a/libcxx/include/__fwd/span.h b/libcxx/include/__fwd/hash.h copy from libcxx/include/__fwd/span.h copy to libcxx/include/__fwd/hash.h --- a/libcxx/include/__fwd/span.h +++ b/libcxx/include/__fwd/hash.h @@ -1,4 +1,3 @@ -// -*- C++ -*- //===---------------------------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. @@ -7,31 +6,20 @@ // //===---------------------------------------------------------------------===// -#ifndef _LIBCPP_FWD_SPAN_H -#define _LIBCPP_FWD_SPAN_H +#ifndef _LIBCPP___FWD_SPAN_H +#define _LIBCPP___FWD_SPAN_H #include <__config> -#include -#include #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 - -inline constexpr size_t dynamic_extent = numeric_limits::max(); -template class span; - -#endif +template +struct _LIBCPP_TEMPLATE_VIS hash; _LIBCPP_END_NAMESPACE_STD -_LIBCPP_POP_MACROS - -#endif // _LIBCPP_FWD_SPAN_H +#endif // _LIBCPP___FWD_SPAN_H diff --git a/libcxx/include/__fwd/span.h b/libcxx/include/__fwd/pair.h copy from libcxx/include/__fwd/span.h copy to libcxx/include/__fwd/pair.h --- a/libcxx/include/__fwd/span.h +++ b/libcxx/include/__fwd/pair.h @@ -1,4 +1,3 @@ -// -*- C++ -*- //===---------------------------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. @@ -7,31 +6,20 @@ // //===---------------------------------------------------------------------===// -#ifndef _LIBCPP_FWD_SPAN_H -#define _LIBCPP_FWD_SPAN_H +#ifndef _LIBCPP___FWD_PAIR_H +#define _LIBCPP___FWD_PAIR_H #include <__config> -#include -#include #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 - -inline constexpr size_t dynamic_extent = numeric_limits::max(); -template class span; - -#endif +template +struct _LIBCPP_TEMPLATE_VIS pair; _LIBCPP_END_NAMESPACE_STD -_LIBCPP_POP_MACROS - -#endif // _LIBCPP_FWD_SPAN_H +#endif // _LIBCPP___FWD_PAIR_H diff --git a/libcxx/include/__fwd/span.h b/libcxx/include/__fwd/span.h --- a/libcxx/include/__fwd/span.h +++ b/libcxx/include/__fwd/span.h @@ -7,8 +7,8 @@ // //===---------------------------------------------------------------------===// -#ifndef _LIBCPP_FWD_SPAN_H -#define _LIBCPP_FWD_SPAN_H +#ifndef _LIBCPP___FWD_HASH_H +#define _LIBCPP___FWD_HASH_H #include <__config> #include @@ -34,4 +34,4 @@ _LIBCPP_POP_MACROS -#endif // _LIBCPP_FWD_SPAN_H +#endif // _LIBCPP___FWD_HASH_H diff --git a/libcxx/include/__fwd/string_view.h b/libcxx/include/__fwd/string_view.h --- a/libcxx/include/__fwd/string_view.h +++ b/libcxx/include/__fwd/string_view.h @@ -7,8 +7,8 @@ // //===---------------------------------------------------------------------===// -#ifndef _LIBCPP_FWD_STRING_VIEW_H -#define _LIBCPP_FWD_STRING_VIEW_H +#ifndef _LIBCPP___FWD_STRING_VIEW_H +#define _LIBCPP___FWD_STRING_VIEW_H #include <__config> #include // char_traits @@ -34,4 +34,4 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_FWD_STRING_VIEW_H +#endif // _LIBCPP___FWD_STRING_VIEW_H diff --git a/libcxx/include/__hash_table b/libcxx/include/__hash_table --- a/libcxx/include/__hash_table +++ b/libcxx/include/__hash_table @@ -18,6 +18,7 @@ #include <__debug> #include <__functional/hash.h> #include <__iterator/iterator_traits.h> +#include <__type_traits/can_extract_key.h> #include <__utility/swap.h> #include #include diff --git a/libcxx/include/__iterator/advance.h b/libcxx/include/__iterator/advance.h --- a/libcxx/include/__iterator/advance.h +++ b/libcxx/include/__iterator/advance.h @@ -15,6 +15,7 @@ #include <__iterator/concepts.h> #include <__iterator/incrementable_traits.h> #include <__iterator/iterator_traits.h> +#include <__utility/convert_to_integral.h> #include <__utility/move.h> #include <__utility/unreachable.h> #include diff --git a/libcxx/include/__iterator/iterator_traits.h b/libcxx/include/__iterator/iterator_traits.h --- a/libcxx/include/__iterator/iterator_traits.h +++ b/libcxx/include/__iterator/iterator_traits.h @@ -11,6 +11,7 @@ #define _LIBCPP___ITERATOR_ITERATOR_TRAITS_H #include <__config> +#include <__fwd/pair.h> #include <__iterator/incrementable_traits.h> #include <__iterator/readable_traits.h> #include diff --git a/libcxx/include/__memory/compressed_pair.h b/libcxx/include/__memory/compressed_pair.h --- a/libcxx/include/__memory/compressed_pair.h +++ b/libcxx/include/__memory/compressed_pair.h @@ -11,6 +11,7 @@ #define _LIBCPP___MEMORY_COMPRESSED_PAIR_H #include <__config> +#include <__type_traits/dependent_type.h> #include <__utility/forward.h> #include <__utility/move.h> #include // needed in c++03 for some constructors diff --git a/libcxx/include/__ranges/join_view.h b/libcxx/include/__ranges/join_view.h --- a/libcxx/include/__ranges/join_view.h +++ b/libcxx/include/__ranges/join_view.h @@ -25,6 +25,7 @@ #include <__ranges/non_propagating_cache.h> #include <__ranges/range_adaptor.h> #include <__ranges/view_interface.h> +#include <__type_traits/maybe_const.h> #include <__utility/forward.h> #include #include @@ -210,7 +211,7 @@ public: using iterator_concept = _If< - __ref_is_glvalue && bidirectional_range<_Base> && bidirectional_range> && + __ref_is_glvalue && bidirectional_range<_Base> && bidirectional_range> && common_range>, bidirectional_iterator_tag, _If< @@ -345,7 +346,7 @@ template explicit join_view(_Range&&) -> join_view>; - + namespace views { namespace __join_view { struct __fn : __range_adaptor_closure<__fn> { diff --git a/libcxx/include/__ranges/lazy_split_view.h b/libcxx/include/__ranges/lazy_split_view.h --- a/libcxx/include/__ranges/lazy_split_view.h +++ b/libcxx/include/__ranges/lazy_split_view.h @@ -35,6 +35,7 @@ #include <__ranges/single_view.h> #include <__ranges/subrange.h> #include <__ranges/view_interface.h> +#include <__type_traits/maybe_const.h> #include <__utility/forward.h> #include <__utility/move.h> #include diff --git a/libcxx/include/__ranges/take_view.h b/libcxx/include/__ranges/take_view.h --- a/libcxx/include/__ranges/take_view.h +++ b/libcxx/include/__ranges/take_view.h @@ -30,6 +30,7 @@ #include <__ranges/size.h> #include <__ranges/subrange.h> #include <__ranges/view_interface.h> +#include <__type_traits/maybe_const.h> #include <__utility/auto_cast.h> #include <__utility/forward.h> #include <__utility/move.h> diff --git a/libcxx/include/__ranges/transform_view.h b/libcxx/include/__ranges/transform_view.h --- a/libcxx/include/__ranges/transform_view.h +++ b/libcxx/include/__ranges/transform_view.h @@ -30,6 +30,7 @@ #include <__ranges/range_adaptor.h> #include <__ranges/size.h> #include <__ranges/view_interface.h> +#include <__type_traits/maybe_const.h> #include <__utility/forward.h> #include <__utility/in_place.h> #include <__utility/move.h> diff --git a/libcxx/include/__threading_support b/libcxx/include/__threading_support --- a/libcxx/include/__threading_support +++ b/libcxx/include/__threading_support @@ -600,6 +600,7 @@ } // namespace this_thread +template struct _LIBCPP_TEMPLATE_VIS hash; template<> struct hash<__thread_id>; class _LIBCPP_TEMPLATE_VIS __thread_id diff --git a/libcxx/include/__tree b/libcxx/include/__tree --- a/libcxx/include/__tree +++ b/libcxx/include/__tree @@ -17,6 +17,7 @@ #include <__iterator/distance.h> #include <__iterator/iterator_traits.h> #include <__iterator/next.h> +#include <__type_traits/can_extract_key.h> #include <__utility/forward.h> #include <__utility/swap.h> #include diff --git a/libcxx/include/__tuple b/libcxx/include/__tuple --- a/libcxx/include/__tuple +++ b/libcxx/include/__tuple @@ -190,6 +190,9 @@ // pair specializations +template +struct _LIBCPP_TEMPLATE_VIS pair; + template struct __tuple_like > : true_type {}; template diff --git a/libcxx/include/__type_traits/can_extract_key.h b/libcxx/include/__type_traits/can_extract_key.h new file mode 100644 --- /dev/null +++ b/libcxx/include/__type_traits/can_extract_key.h @@ -0,0 +1,58 @@ +//===----------------------------------------------------------------------===// +// +// 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_CAN_EXTRACT_KEY_H +#define _LIBCPP___TYPE_TRAITS_CAN_EXTRACT_KEY_H + +#include <__config> +#include <__fwd/pair.h> +#include <__type_traits/conditional.h> +#include <__type_traits/integral_constant.h> +#include <__type_traits/is_same.h> +#include <__type_traits/remove_const.h> +#include <__type_traits/remove_const_ref.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +// These traits are used in __tree and __hash_table +struct __extract_key_fail_tag {}; +struct __extract_key_self_tag {}; +struct __extract_key_first_tag {}; + +template ::type> +struct __can_extract_key + : conditional<_IsSame<_RawValTy, _Key>::value, __extract_key_self_tag, + __extract_key_fail_tag>::type {}; + +template +struct __can_extract_key<_Pair, _Key, pair<_First, _Second> > + : conditional<_IsSame::type, _Key>::value, + __extract_key_first_tag, __extract_key_fail_tag>::type {}; + +// __can_extract_map_key uses true_type/false_type instead of the tags. +// It returns true if _Key != _ContainerValueTy (the container is a map not a set) +// and _ValTy == _Key. +template ::type> +struct __can_extract_map_key + : integral_constant::value> {}; + +// This specialization returns __extract_key_fail_tag for non-map containers +// because _Key == _ContainerValueTy +template +struct __can_extract_map_key<_ValTy, _Key, _Key, _RawValTy> + : false_type {}; + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_CAN_EXTRACT_KEY_H diff --git a/libcxx/include/__fwd/span.h b/libcxx/include/__type_traits/dependent_type.h copy from libcxx/include/__fwd/span.h copy to libcxx/include/__type_traits/dependent_type.h --- a/libcxx/include/__fwd/span.h +++ b/libcxx/include/__type_traits/dependent_type.h @@ -1,37 +1,25 @@ -// -*- C++ -*- -//===---------------------------------------------------------------------===// +//===----------------------------------------------------------------------===// // // 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_FWD_SPAN_H -#define _LIBCPP_FWD_SPAN_H +#ifndef _LIBCPP___TYPE_TRAITS_DEPENDENT_TYPE_H +#define _LIBCPP___TYPE_TRAITS_DEPENDENT_TYPE_H #include <__config> -#include -#include #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 - -inline constexpr size_t dynamic_extent = numeric_limits::max(); -template class span; - -#endif +template +struct _LIBCPP_TEMPLATE_VIS __dependent_type : public _Tp {}; _LIBCPP_END_NAMESPACE_STD -_LIBCPP_POP_MACROS - -#endif // _LIBCPP_FWD_SPAN_H +#endif // _LIBCPP___TYPE_TRAITS_DEPENDENT_TYPE_H diff --git a/libcxx/include/__fwd/span.h b/libcxx/include/__type_traits/is_char_like_type.h copy from libcxx/include/__fwd/span.h copy to libcxx/include/__type_traits/is_char_like_type.h --- a/libcxx/include/__fwd/span.h +++ b/libcxx/include/__type_traits/is_char_like_type.h @@ -1,37 +1,28 @@ -// -*- C++ -*- -//===---------------------------------------------------------------------===// +//===----------------------------------------------------------------------===// // // 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_FWD_SPAN_H -#define _LIBCPP_FWD_SPAN_H +#ifndef _LIBCPP___TYPE_TRAITS_IS_CHAR_LIKE_TYPE_H +#define _LIBCPP___TYPE_TRAITS_IS_CHAR_LIKE_TYPE_H #include <__config> -#include -#include +#include <__type_traits/conjunction.h> +#include <__type_traits/is_standard_layout.h> +#include <__type_traits/is_trivial.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 - -inline constexpr size_t dynamic_extent = numeric_limits::max(); -template class span; - -#endif +template +using _IsCharLikeType = _And, is_trivial<_CharT> >; _LIBCPP_END_NAMESPACE_STD -_LIBCPP_POP_MACROS - -#endif // _LIBCPP_FWD_SPAN_H +#endif // _LIBCPP___TYPE_TRAITS_IS_CHAR_LIKE_TYPE_H diff --git a/libcxx/include/__type_traits/is_implicitly_default_constructible.h b/libcxx/include/__type_traits/is_implicitly_default_constructible.h new file mode 100644 --- /dev/null +++ b/libcxx/include/__type_traits/is_implicitly_default_constructible.h @@ -0,0 +1,48 @@ +//===----------------------------------------------------------------------===// +// +// 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_IMPLICITLY_DEFAULT_CONSTRUCTIBLE_H +#define _LIBCPP___TYPE_TRAITS_IS_IMPLICITLY_DEFAULT_CONSTRUCTIBLE_H + +#include <__config> +#include <__type_traits/integral_constant.h> +#include <__type_traits/is_default_constructible.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +#ifndef _LIBCPP_CXX03_LANG +// First of all, we can't implement this check in C++03 mode because the {} +// default initialization syntax isn't valid. +// Second, we implement the trait in a funny manner with two defaulted template +// arguments to workaround Clang's PR43454. +template +void __test_implicit_default_constructible(_Tp); + +template ::type> +struct __is_implicitly_default_constructible + : false_type +{ }; + +template +struct __is_implicitly_default_constructible<_Tp, decltype(__test_implicit_default_constructible<_Tp const&>({})), true_type> + : true_type +{ }; + +template +struct __is_implicitly_default_constructible<_Tp, decltype(__test_implicit_default_constructible<_Tp const&>({})), false_type> + : false_type +{ }; +#endif // !C++03 + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_IS_IMPLICITLY_DEFAULT_CONSTRUCTIBLE_H diff --git a/libcxx/include/__type_traits/is_swappable.h b/libcxx/include/__type_traits/is_swappable.h new file mode 100644 --- /dev/null +++ b/libcxx/include/__type_traits/is_swappable.h @@ -0,0 +1,165 @@ +//===----------------------------------------------------------------------===// +// +// 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_SWAPPABLE_H +#define _LIBCPP___TYPE_TRAITS_IS_SWAPPABLE_H + +#include <__config> +#include <__type_traits/add_lvalue_reference.h> +#include <__type_traits/conditional.h> +#include <__type_traits/enable_if.h> +#include <__type_traits/is_move_assignable.h> +#include <__type_traits/is_move_constructible.h> +#include <__type_traits/is_nothrow_move_assignable.h> +#include <__type_traits/is_nothrow_move_constructible.h> +#include <__type_traits/is_referenceable.h> +#include <__type_traits/is_same.h> +#include <__type_traits/is_swappable.h> +#include <__type_traits/is_void.h> +#include <__type_traits/nat.h> +#include + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +template struct __is_swappable; +template struct __is_nothrow_swappable; + + +#ifndef _LIBCPP_CXX03_LANG +template +using __swap_result_t = typename enable_if::value && is_move_assignable<_Tp>::value>::type; +#else +template +using __swap_result_t = void; +#endif + +template +inline _LIBCPP_INLINE_VISIBILITY +_LIBCPP_CONSTEXPR_AFTER_CXX17 __swap_result_t<_Tp> +swap(_Tp& __x, _Tp& __y) _NOEXCEPT_(is_nothrow_move_constructible<_Tp>::value && + is_nothrow_move_assignable<_Tp>::value); + +template +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 +typename enable_if< + __is_swappable<_Tp>::value +>::type +swap(_Tp (&__a)[_Np], _Tp (&__b)[_Np]) _NOEXCEPT_(__is_nothrow_swappable<_Tp>::value); + +namespace __detail +{ +// ALL generic swap overloads MUST already have a declaration available at this point. + +template ::value && !is_void<_Up>::value> +struct __swappable_with +{ + template + static decltype(swap(declval<_LHS>(), declval<_RHS>())) + __test_swap(int); + template + static __nat __test_swap(long); + + // Extra parens are needed for the C++03 definition of decltype. + typedef decltype((__test_swap<_Tp, _Up>(0))) __swap1; + typedef decltype((__test_swap<_Up, _Tp>(0))) __swap2; + + static const bool value = _IsNotSame<__swap1, __nat>::value + && _IsNotSame<__swap2, __nat>::value; +}; + +template +struct __swappable_with<_Tp, _Up, false> : false_type {}; + +template ::value> +struct __nothrow_swappable_with { + static const bool value = +#ifndef _LIBCPP_HAS_NO_NOEXCEPT + noexcept(swap(declval<_Tp>(), declval<_Up>())) + && noexcept(swap(declval<_Up>(), declval<_Tp>())); +#else + false; +#endif +}; + +template +struct __nothrow_swappable_with<_Tp, _Up, false> : false_type {}; + +} // namespace __detail + +template +struct __is_swappable + : public integral_constant::value> +{ +}; + +template +struct __is_nothrow_swappable + : public integral_constant::value> +{ +}; + +#if _LIBCPP_STD_VER > 14 + +template +struct _LIBCPP_TEMPLATE_VIS is_swappable_with + : public integral_constant::value> +{ +}; + +template +struct _LIBCPP_TEMPLATE_VIS is_swappable + : public conditional< + __is_referenceable<_Tp>::value, + is_swappable_with< + typename add_lvalue_reference<_Tp>::type, + typename add_lvalue_reference<_Tp>::type>, + false_type + >::type +{ +}; + +template +struct _LIBCPP_TEMPLATE_VIS is_nothrow_swappable_with + : public integral_constant::value> +{ +}; + +template +struct _LIBCPP_TEMPLATE_VIS is_nothrow_swappable + : public conditional< + __is_referenceable<_Tp>::value, + is_nothrow_swappable_with< + typename add_lvalue_reference<_Tp>::type, + typename add_lvalue_reference<_Tp>::type>, + false_type + >::type +{ +}; + +template +inline constexpr bool is_swappable_with_v = is_swappable_with<_Tp, _Up>::value; + +template +inline constexpr bool is_swappable_v = is_swappable<_Tp>::value; + +template +inline constexpr bool is_nothrow_swappable_with_v = is_nothrow_swappable_with<_Tp, _Up>::value; + +template +inline constexpr bool is_nothrow_swappable_v = is_nothrow_swappable<_Tp>::value; + +#endif // _LIBCPP_STD_VER > 14 + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_IS_SWAPPABLE_H diff --git a/libcxx/include/__fwd/span.h b/libcxx/include/__type_traits/make_const_lvalue_ref.h copy from libcxx/include/__fwd/span.h copy to libcxx/include/__type_traits/make_const_lvalue_ref.h --- a/libcxx/include/__fwd/span.h +++ b/libcxx/include/__type_traits/make_const_lvalue_ref.h @@ -1,37 +1,26 @@ -// -*- C++ -*- -//===---------------------------------------------------------------------===// +//===----------------------------------------------------------------------===// // // 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_FWD_SPAN_H -#define _LIBCPP_FWD_SPAN_H +#ifndef _LIBCPP___TYPE_TRAITS_MAKE_CONST_LVALUE_REF_H +#define _LIBCPP___TYPE_TRAITS_MAKE_CONST_LVALUE_REF_H #include <__config> -#include -#include +#include <__type_traits/remove_reference.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 - -inline constexpr size_t dynamic_extent = numeric_limits::max(); -template class span; - -#endif +template +using __make_const_lvalue_ref = const typename remove_reference<_Tp>::type&; _LIBCPP_END_NAMESPACE_STD -_LIBCPP_POP_MACROS - -#endif // _LIBCPP_FWD_SPAN_H +#endif // _LIBCPP___TYPE_TRAITS_MAKE_CONST_LVALUE_REF_H diff --git a/libcxx/include/__fwd/span.h b/libcxx/include/__type_traits/maybe_const.h copy from libcxx/include/__fwd/span.h copy to libcxx/include/__type_traits/maybe_const.h --- a/libcxx/include/__fwd/span.h +++ b/libcxx/include/__type_traits/maybe_const.h @@ -1,37 +1,26 @@ -// -*- C++ -*- -//===---------------------------------------------------------------------===// +//===----------------------------------------------------------------------===// // // 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_FWD_SPAN_H -#define _LIBCPP_FWD_SPAN_H +#ifndef _LIBCPP___TYPE_TRAITS_MAYBE_CONST_H +#define _LIBCPP___TYPE_TRAITS_MAYBE_CONST_H #include <__config> -#include -#include +#include <__type_traits/conditional.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 - -inline constexpr size_t dynamic_extent = numeric_limits::max(); -template class span; - -#endif +template +using __maybe_const = typename conditional<_Const, const _Tp, _Tp>::type; _LIBCPP_END_NAMESPACE_STD -_LIBCPP_POP_MACROS - -#endif // _LIBCPP_FWD_SPAN_H +#endif // _LIBCPP___TYPE_TRAITS_MAYBE_CONST_H diff --git a/libcxx/include/__fwd/span.h b/libcxx/include/__type_traits/remove_const_ref.h copy from libcxx/include/__fwd/span.h copy to libcxx/include/__type_traits/remove_const_ref.h --- a/libcxx/include/__fwd/span.h +++ b/libcxx/include/__type_traits/remove_const_ref.h @@ -1,37 +1,29 @@ -// -*- C++ -*- -//===---------------------------------------------------------------------===// +//===----------------------------------------------------------------------===// // // 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_FWD_SPAN_H -#define _LIBCPP_FWD_SPAN_H +#ifndef _LIBCPP___TYPE_TRAITS_REMOVE_CONST_REF_H +#define _LIBCPP___TYPE_TRAITS_REMOVE_CONST_REF_H #include <__config> -#include -#include +#include <__type_traits/remove_const.h> +#include <__type_traits/remove_reference.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 - -inline constexpr size_t dynamic_extent = numeric_limits::max(); -template class span; - -#endif +template +struct __unconstref { + typedef _LIBCPP_NODEBUG typename remove_const::type>::type type; +}; _LIBCPP_END_NAMESPACE_STD -_LIBCPP_POP_MACROS - -#endif // _LIBCPP_FWD_SPAN_H +#endif // _LIBCPP___TYPE_TRAITS_REMOVE_CONST_REF_H diff --git a/libcxx/include/__type_traits/result_of.h b/libcxx/include/__type_traits/result_of.h new file mode 100644 --- /dev/null +++ b/libcxx/include/__type_traits/result_of.h @@ -0,0 +1,39 @@ +//===----------------------------------------------------------------------===// +// +// 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_RESULT_OF_H +#define _LIBCPP___TYPE_TRAITS_RESULT_OF_H + +#include <__config> +#include <__functional/invoke.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +// result_of + +#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_TYPE_TRAITS) +template class _LIBCPP_DEPRECATED_IN_CXX17 result_of; + +template +class _LIBCPP_TEMPLATE_VIS result_of<_Fp(_Args...)> + : public __invoke_of<_Fp, _Args...> +{ +}; + +#if _LIBCPP_STD_VER > 11 +template using result_of_t _LIBCPP_DEPRECATED_IN_CXX17 = typename result_of<_Tp>::type; +#endif // _LIBCPP_STD_VER > 11 +#endif // _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_TYPE_TRAITS) + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_RESULT_OF_H diff --git a/libcxx/include/__utility/convert_to_integral.h b/libcxx/include/__utility/convert_to_integral.h new file mode 100644 --- /dev/null +++ b/libcxx/include/__utility/convert_to_integral.h @@ -0,0 +1,72 @@ +//===----------------------------------------------------------------------===// +// +// 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___UTILITY_CONVERT_TO_INTEGRAL_H +#define _LIBCPP___UTILITY_CONVERT_TO_INTEGRAL_H + +#include <__config> +#include <__type_traits/enable_if.h> +#include <__type_traits/is_enum.h> +#include <__type_traits/is_floating_point.h> +#include <__type_traits/underlying_type.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR +int __convert_to_integral(int __val) { return __val; } + +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR +unsigned __convert_to_integral(unsigned __val) { return __val; } + +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR +long __convert_to_integral(long __val) { return __val; } + +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR +unsigned long __convert_to_integral(unsigned long __val) { return __val; } + +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR +long long __convert_to_integral(long long __val) { return __val; } + +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR +unsigned long long __convert_to_integral(unsigned long long __val) {return __val; } + +template +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR +typename enable_if::value, long long>::type + __convert_to_integral(_Fp __val) { return __val; } + +#ifndef _LIBCPP_HAS_NO_INT128 +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR +__int128_t __convert_to_integral(__int128_t __val) { return __val; } + +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR +__uint128_t __convert_to_integral(__uint128_t __val) { return __val; } +#endif + +template ::value> +struct __sfinae_underlying_type +{ + typedef typename underlying_type<_Tp>::type type; + typedef decltype(((type)1) + 0) __promoted_type; +}; + +template +struct __sfinae_underlying_type<_Tp, false> {}; + +template +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR +typename __sfinae_underlying_type<_Tp>::__promoted_type +__convert_to_integral(_Tp __val) { return __val; } + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___UTILITY_CONVERT_TO_INTEGRAL_H diff --git a/libcxx/include/__utility/pair.h b/libcxx/include/__utility/pair.h --- a/libcxx/include/__utility/pair.h +++ b/libcxx/include/__utility/pair.h @@ -14,6 +14,7 @@ #include <__config> #include <__functional/unwrap_ref.h> #include <__tuple> +#include <__type_traits/is_implicitly_default_constructible.h> #include <__utility/forward.h> #include <__utility/move.h> #include <__utility/piecewise_construct.h> diff --git a/libcxx/include/bitset b/libcxx/include/bitset --- a/libcxx/include/bitset +++ b/libcxx/include/bitset @@ -118,6 +118,7 @@ #include <__config> #include <__functional/hash.h> #include <__functional/unary_function.h> +#include <__type_traits/is_char_like_type.h> #include #include #include diff --git a/libcxx/include/experimental/propagate_const b/libcxx/include/experimental/propagate_const --- a/libcxx/include/experimental/propagate_const +++ b/libcxx/include/experimental/propagate_const @@ -108,6 +108,7 @@ */ #include <__assert> // all public C++ headers provide the assertion handler +#include <__functional/hash.h> #include <__functional/operations.h> #include <__utility/forward.h> #include <__utility/move.h> diff --git a/libcxx/include/module.modulemap.in b/libcxx/include/module.modulemap.in --- a/libcxx/include/module.modulemap.in +++ b/libcxx/include/module.modulemap.in @@ -280,7 +280,10 @@ module is_sorted { private header "__algorithm/is_sorted.h" } module is_sorted_until { private header "__algorithm/is_sorted_until.h" } module iter_swap { private header "__algorithm/iter_swap.h" } - module iterator_operations { private header "__algorithm/iterator_operations.h" } + module iterator_operations { + private header "__algorithm/iterator_operations.h" + export * + } module lexicographical_compare { private header "__algorithm/lexicographical_compare.h" } module lower_bound { private header "__algorithm/lower_bound.h" } module make_heap { private header "__algorithm/make_heap.h" } @@ -1084,122 +1087,131 @@ 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 aligned_storage { private header "__type_traits/aligned_storage.h" } - module aligned_union { private header "__type_traits/aligned_union.h" } - module alignment_of { private header "__type_traits/alignment_of.h" } - module apply_cv { private header "__type_traits/apply_cv.h" } - module common_reference { private header "__type_traits/common_reference.h" } - module common_type { private header "__type_traits/common_type.h" } - module conditional { private header "__type_traits/conditional.h" } - module conjunction { private header "__type_traits/conjunction.h" } - module copy_cv { private header "__type_traits/copy_cv.h" } - module copy_cvref { private header "__type_traits/copy_cvref.h" } - module decay { private header "__type_traits/decay.h" } - module disjunction { private header "__type_traits/disjunction.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_arithmetic { private header "__type_traits/is_arithmetic.h" } - module is_array { private header "__type_traits/is_array.h" } - module is_assignable { private header "__type_traits/is_assignable.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_constant_evaluated { private header "__type_traits/is_constant_evaluated.h" } - module is_constructible { private header "__type_traits/is_constructible.h" } - module is_convertible { private header "__type_traits/is_convertible.h" } - module is_copy_assignable { private header "__type_traits/is_copy_assignable.h" } - module is_copy_constructible { private header "__type_traits/is_copy_constructible.h" } - module is_core_convertible { private header "__type_traits/is_core_convertible.h" } - module is_default_constructible { private header "__type_traits/is_default_constructible.h" } - module is_destructible { private header "__type_traits/is_destructible.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_move_constructible { private header "__type_traits/is_move_constructible.h" } - module is_nothrow_assignable { private header "__type_traits/is_nothrow_assignable.h" } - module is_nothrow_constructible { private header "__type_traits/is_nothrow_constructible.h" } - module is_nothrow_convertible { private header "__type_traits/is_nothrow_convertible.h" } - module is_nothrow_copy_assignable { private header "__type_traits/is_nothrow_copy_assignable.h" } - module is_nothrow_copy_constructible { private header "__type_traits/is_nothrow_copy_constructible.h" } - module is_nothrow_default_constructible { private header "__type_traits/is_nothrow_default_constructible.h" } - module is_nothrow_destructible { private header "__type_traits/is_nothrow_destructible.h" } - module is_nothrow_move_assignable { private header "__type_traits/is_nothrow_move_assignable.h" } - module is_nothrow_move_constructible { private header "__type_traits/is_nothrow_move_constructible.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_pointer { private header "__type_traits/is_pointer.h" } - module is_polymorphic { private header "__type_traits/is_polymorphic.h" } - module is_primary_template { private header "__type_traits/is_primary_template.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_signed_integer { private header "__type_traits/is_signed_integer.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_assignable { private header "__type_traits/is_trivially_assignable.h" } - module is_trivially_constructible { private header "__type_traits/is_trivially_constructible.h" } - module is_trivially_copy_assignable { private header "__type_traits/is_trivially_copy_assignable.h" } - module is_trivially_copy_constructible { private header "__type_traits/is_trivially_copy_constructible.h" } - module is_trivially_copyable { private header "__type_traits/is_trivially_copyable.h" } - module is_trivially_default_constructible { private header "__type_traits/is_trivially_default_constructible.h" } - module is_trivially_destructible { private header "__type_traits/is_trivially_destructible.h" } - module is_trivially_move_assignable { private header "__type_traits/is_trivially_move_assignable.h" } - module is_trivially_move_constructible { private header "__type_traits/is_trivially_move_constructible.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_unsigned_integer { private header "__type_traits/is_unsigned_integer.h" } - module is_valid_expansion { private header "__type_traits/is_valid_expansion.h" } - module is_void { private header "__type_traits/is_void.h" } - module is_volatile { private header "__type_traits/is_volatile.h" } - module lazy { private header "__type_traits/lazy.h" } - module make_32_64_or_128_bit { private header "__type_traits/make_32_64_or_128_bit.h" } - module make_signed { private header "__type_traits/make_signed.h" } - module make_unsigned { private header "__type_traits/make_unsigned.h" } - module nat { private header "__type_traits/nat.h" } - module negation { private header "__type_traits/negation.h" } - module promote { private header "__type_traits/promote.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_cvref { private header "__type_traits/remove_cvref.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 type_list { private header "__type_traits/type_list.h" } - module underlying_type { private header "__type_traits/underlying_type.h" } - module void_t { private header "__type_traits/void_t.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 aligned_storage { private header "__type_traits/aligned_storage.h" } + module aligned_union { private header "__type_traits/aligned_union.h" } + module alignment_of { private header "__type_traits/alignment_of.h" } + module apply_cv { private header "__type_traits/apply_cv.h" } + module can_extract_key { private header "__type_traits/can_extract_key.h" } + module common_reference { private header "__type_traits/common_reference.h" } + module common_type { private header "__type_traits/common_type.h" } + module conditional { private header "__type_traits/conditional.h" } + module conjunction { private header "__type_traits/conjunction.h" } + module copy_cv { private header "__type_traits/copy_cv.h" } + module copy_cvref { private header "__type_traits/copy_cvref.h" } + module decay { private header "__type_traits/decay.h" } + module dependent_type { private header "__type_traits/dependent_type.h" } + module disjunction { private header "__type_traits/disjunction.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_arithmetic { private header "__type_traits/is_arithmetic.h" } + module is_array { private header "__type_traits/is_array.h" } + module is_assignable { private header "__type_traits/is_assignable.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_char_like_type { private header "__type_traits/is_char_like_type.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_constant_evaluated { private header "__type_traits/is_constant_evaluated.h" } + module is_constructible { private header "__type_traits/is_constructible.h" } + module is_convertible { private header "__type_traits/is_convertible.h" } + module is_copy_assignable { private header "__type_traits/is_copy_assignable.h" } + module is_copy_constructible { private header "__type_traits/is_copy_constructible.h" } + module is_core_convertible { private header "__type_traits/is_core_convertible.h" } + module is_default_constructible { private header "__type_traits/is_default_constructible.h" } + module is_destructible { private header "__type_traits/is_destructible.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_implicitly_default_constructible { private header "__type_traits/is_implicitly_default_constructible.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_move_constructible { private header "__type_traits/is_move_constructible.h" } + module is_nothrow_assignable { private header "__type_traits/is_nothrow_assignable.h" } + module is_nothrow_constructible { private header "__type_traits/is_nothrow_constructible.h" } + module is_nothrow_convertible { private header "__type_traits/is_nothrow_convertible.h" } + module is_nothrow_copy_assignable { private header "__type_traits/is_nothrow_copy_assignable.h" } + module is_nothrow_copy_constructible { private header "__type_traits/is_nothrow_copy_constructible.h" } + module is_nothrow_default_constructible { private header "__type_traits/is_nothrow_default_constructible.h" } + module is_nothrow_destructible { private header "__type_traits/is_nothrow_destructible.h" } + module is_nothrow_move_assignable { private header "__type_traits/is_nothrow_move_assignable.h" } + module is_nothrow_move_constructible { private header "__type_traits/is_nothrow_move_constructible.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_pointer { private header "__type_traits/is_pointer.h" } + module is_polymorphic { private header "__type_traits/is_polymorphic.h" } + module is_primary_template { private header "__type_traits/is_primary_template.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_signed_integer { private header "__type_traits/is_signed_integer.h" } + module is_standard_layout { private header "__type_traits/is_standard_layout.h" } + module is_swappable { private header "__type_traits/is_swappable.h" } + module is_trivial { private header "__type_traits/is_trivial.h" } + module is_trivially_assignable { private header "__type_traits/is_trivially_assignable.h" } + module is_trivially_constructible { private header "__type_traits/is_trivially_constructible.h" } + module is_trivially_copy_assignable { private header "__type_traits/is_trivially_copy_assignable.h" } + module is_trivially_copy_constructible { private header "__type_traits/is_trivially_copy_constructible.h" } + module is_trivially_copyable { private header "__type_traits/is_trivially_copyable.h" } + module is_trivially_default_constructible { private header "__type_traits/is_trivially_default_constructible.h" } + module is_trivially_destructible { private header "__type_traits/is_trivially_destructible.h" } + module is_trivially_move_assignable { private header "__type_traits/is_trivially_move_assignable.h" } + module is_trivially_move_constructible { private header "__type_traits/is_trivially_move_constructible.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_unsigned_integer { private header "__type_traits/is_unsigned_integer.h" } + module is_valid_expansion { private header "__type_traits/is_valid_expansion.h" } + module is_void { private header "__type_traits/is_void.h" } + module is_volatile { private header "__type_traits/is_volatile.h" } + module lazy { private header "__type_traits/lazy.h" } + module make_32_64_or_128_bit { private header "__type_traits/make_32_64_or_128_bit.h" } + module make_const_lvalue_ref { private header "__type_traits/make_const_lvalue_ref.h" } + module make_signed { private header "__type_traits/make_signed.h" } + module make_unsigned { private header "__type_traits/make_unsigned.h" } + module maybe_const { private header "__type_traits/maybe_const.h" } + module nat { private header "__type_traits/nat.h" } + module negation { private header "__type_traits/negation.h" } + module promote { private header "__type_traits/promote.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_const_ref { private header "__type_traits/remove_const_ref.h" } + module remove_cv { private header "__type_traits/remove_cv.h" } + module remove_cvref { private header "__type_traits/remove_cvref.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 result_of { private header "__type_traits/result_of.h" } + module type_identity { private header "__type_traits/type_identity.h" } + module type_list { private header "__type_traits/type_list.h" } + module underlying_type { private header "__type_traits/underlying_type.h" } + module void_t { private header "__type_traits/void_t.h" } } module typeindex { header "typeindex" @@ -1228,6 +1240,7 @@ module as_const { private header "__utility/as_const.h" } module auto_cast { private header "__utility/auto_cast.h" } module cmp { private header "__utility/cmp.h" } + module convert_to_integral { private header "__utility/convert_to_integral.h" } module declval { private header "__utility/declval.h" } module exchange { private header "__utility/exchange.h" } module forward { private header "__utility/forward.h" } diff --git a/libcxx/include/tuple b/libcxx/include/tuple --- a/libcxx/include/tuple +++ b/libcxx/include/tuple @@ -209,6 +209,7 @@ #include <__memory/allocator_arg_t.h> #include <__memory/uses_allocator.h> #include <__tuple> +#include <__type_traits/maybe_const.h> #include <__utility/forward.h> #include <__utility/integer_sequence.h> #include <__utility/move.h> diff --git a/libcxx/include/type_traits b/libcxx/include/type_traits --- a/libcxx/include/type_traits +++ b/libcxx/include/type_traits @@ -419,6 +419,7 @@ #include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <__functional/invoke.h> +#include <__fwd/hash.h> #include <__type_traits/add_const.h> #include <__type_traits/add_cv.h> #include <__type_traits/add_lvalue_reference.h> @@ -493,6 +494,7 @@ #include <__type_traits/is_scoped_enum.h> #include <__type_traits/is_signed.h> #include <__type_traits/is_standard_layout.h> +#include <__type_traits/is_swappable.h> #include <__type_traits/is_trivial.h> #include <__type_traits/is_trivially_assignable.h> #include <__type_traits/is_trivially_constructible.h> @@ -519,6 +521,7 @@ #include <__type_traits/remove_pointer.h> #include <__type_traits/remove_reference.h> #include <__type_traits/remove_volatile.h> +#include <__type_traits/result_of.h> #include <__type_traits/type_identity.h> #include <__type_traits/underlying_type.h> #include <__type_traits/void_t.h> @@ -531,280 +534,4 @@ # pragma GCC system_header #endif -_LIBCPP_BEGIN_NAMESPACE_STD - -template struct _LIBCPP_TEMPLATE_VIS pair; -template struct _LIBCPP_TEMPLATE_VIS hash; - -// Member detector base - -template -struct _LIBCPP_TEMPLATE_VIS __dependent_type : public _Tp {}; - -// is_integral - -template -struct __unconstref { - typedef _LIBCPP_NODEBUG typename remove_const::type>::type type; -}; - -#ifndef _LIBCPP_CXX03_LANG -// First of all, we can't implement this check in C++03 mode because the {} -// default initialization syntax isn't valid. -// Second, we implement the trait in a funny manner with two defaulted template -// arguments to workaround Clang's PR43454. -template -void __test_implicit_default_constructible(_Tp); - -template ::type> -struct __is_implicitly_default_constructible - : false_type -{ }; - -template -struct __is_implicitly_default_constructible<_Tp, decltype(__test_implicit_default_constructible<_Tp const&>({})), true_type> - : true_type -{ }; - -template -struct __is_implicitly_default_constructible<_Tp, decltype(__test_implicit_default_constructible<_Tp const&>({})), false_type> - : false_type -{ }; -#endif // !C++03 - -// result_of - -#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_TYPE_TRAITS) -template class _LIBCPP_DEPRECATED_IN_CXX17 result_of; - -template -class _LIBCPP_TEMPLATE_VIS result_of<_Fp(_Args...)> - : public __invoke_of<_Fp, _Args...> -{ -}; - -#if _LIBCPP_STD_VER > 11 -template using result_of_t _LIBCPP_DEPRECATED_IN_CXX17 = typename result_of<_Tp>::type; -#endif // _LIBCPP_STD_VER > 11 -#endif // _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_TYPE_TRAITS) - -// __swappable - -template struct __is_swappable; -template struct __is_nothrow_swappable; - - -#ifndef _LIBCPP_CXX03_LANG -template -using __swap_result_t = typename enable_if::value && is_move_assignable<_Tp>::value>::type; -#else -template -using __swap_result_t = void; -#endif - -template -inline _LIBCPP_INLINE_VISIBILITY -_LIBCPP_CONSTEXPR_AFTER_CXX17 __swap_result_t<_Tp> -swap(_Tp& __x, _Tp& __y) _NOEXCEPT_(is_nothrow_move_constructible<_Tp>::value && - is_nothrow_move_assignable<_Tp>::value); - -template -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 -typename enable_if< - __is_swappable<_Tp>::value ->::type -swap(_Tp (&__a)[_Np], _Tp (&__b)[_Np]) _NOEXCEPT_(__is_nothrow_swappable<_Tp>::value); - -namespace __detail -{ -// ALL generic swap overloads MUST already have a declaration available at this point. - -template ::value && !is_void<_Up>::value> -struct __swappable_with -{ - template - static decltype(swap(declval<_LHS>(), declval<_RHS>())) - __test_swap(int); - template - static __nat __test_swap(long); - - // Extra parens are needed for the C++03 definition of decltype. - typedef decltype((__test_swap<_Tp, _Up>(0))) __swap1; - typedef decltype((__test_swap<_Up, _Tp>(0))) __swap2; - - static const bool value = _IsNotSame<__swap1, __nat>::value - && _IsNotSame<__swap2, __nat>::value; -}; - -template -struct __swappable_with<_Tp, _Up, false> : false_type {}; - -template ::value> -struct __nothrow_swappable_with { - static const bool value = -#ifndef _LIBCPP_HAS_NO_NOEXCEPT - noexcept(swap(declval<_Tp>(), declval<_Up>())) - && noexcept(swap(declval<_Up>(), declval<_Tp>())); -#else - false; -#endif -}; - -template -struct __nothrow_swappable_with<_Tp, _Up, false> : false_type {}; - -} // namespace __detail - -template -struct __is_swappable - : public integral_constant::value> -{ -}; - -template -struct __is_nothrow_swappable - : public integral_constant::value> -{ -}; - -#if _LIBCPP_STD_VER > 14 - -template -struct _LIBCPP_TEMPLATE_VIS is_swappable_with - : public integral_constant::value> -{ -}; - -template -struct _LIBCPP_TEMPLATE_VIS is_swappable - : public conditional< - __is_referenceable<_Tp>::value, - is_swappable_with< - typename add_lvalue_reference<_Tp>::type, - typename add_lvalue_reference<_Tp>::type>, - false_type - >::type -{ -}; - -template -struct _LIBCPP_TEMPLATE_VIS is_nothrow_swappable_with - : public integral_constant::value> -{ -}; - -template -struct _LIBCPP_TEMPLATE_VIS is_nothrow_swappable - : public conditional< - __is_referenceable<_Tp>::value, - is_nothrow_swappable_with< - typename add_lvalue_reference<_Tp>::type, - typename add_lvalue_reference<_Tp>::type>, - false_type - >::type -{ -}; - -template -inline constexpr bool is_swappable_with_v = is_swappable_with<_Tp, _Up>::value; - -template -inline constexpr bool is_swappable_v = is_swappable<_Tp>::value; - -template -inline constexpr bool is_nothrow_swappable_with_v = is_nothrow_swappable_with<_Tp, _Up>::value; - -template -inline constexpr bool is_nothrow_swappable_v = is_nothrow_swappable<_Tp>::value; - -#endif // _LIBCPP_STD_VER > 14 - -template ::value> -struct __sfinae_underlying_type -{ - typedef typename underlying_type<_Tp>::type type; - typedef decltype(((type)1) + 0) __promoted_type; -}; - -template -struct __sfinae_underlying_type<_Tp, false> {}; - -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR -int __convert_to_integral(int __val) { return __val; } - -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR -unsigned __convert_to_integral(unsigned __val) { return __val; } - -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR -long __convert_to_integral(long __val) { return __val; } - -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR -unsigned long __convert_to_integral(unsigned long __val) { return __val; } - -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR -long long __convert_to_integral(long long __val) { return __val; } - -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR -unsigned long long __convert_to_integral(unsigned long long __val) {return __val; } - -template -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR -typename enable_if::value, long long>::type - __convert_to_integral(_Fp __val) { return __val; } - -#ifndef _LIBCPP_HAS_NO_INT128 -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR -__int128_t __convert_to_integral(__int128_t __val) { return __val; } - -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR -__uint128_t __convert_to_integral(__uint128_t __val) { return __val; } -#endif - -template -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR -typename __sfinae_underlying_type<_Tp>::__promoted_type -__convert_to_integral(_Tp __val) { return __val; } - -// These traits are used in __tree and __hash_table -struct __extract_key_fail_tag {}; -struct __extract_key_self_tag {}; -struct __extract_key_first_tag {}; - -template ::type> -struct __can_extract_key - : conditional<_IsSame<_RawValTy, _Key>::value, __extract_key_self_tag, - __extract_key_fail_tag>::type {}; - -template -struct __can_extract_key<_Pair, _Key, pair<_First, _Second> > - : conditional<_IsSame::type, _Key>::value, - __extract_key_first_tag, __extract_key_fail_tag>::type {}; - -// __can_extract_map_key uses true_type/false_type instead of the tags. -// It returns true if _Key != _ContainerValueTy (the container is a map not a set) -// and _ValTy == _Key. -template ::type> -struct __can_extract_map_key - : integral_constant::value> {}; - -// This specialization returns __extract_key_fail_tag for non-map containers -// because _Key == _ContainerValueTy -template -struct __can_extract_map_key<_ValTy, _Key, _Key, _RawValTy> - : false_type {}; - -template -using _IsCharLikeType = _And, is_trivial<_CharT> >; - -template -using __make_const_lvalue_ref = const typename remove_reference<_Tp>::type&; - -template -using __maybe_const = typename conditional<_Const, const _Tp, _Tp>::type; - -_LIBCPP_END_NAMESPACE_STD - #endif // _LIBCPP_TYPE_TRAITS diff --git a/libcxx/include/variant b/libcxx/include/variant --- a/libcxx/include/variant +++ b/libcxx/include/variant @@ -206,6 +206,7 @@ #include <__functional/operations.h> #include <__functional/unary_function.h> #include <__tuple> +#include <__type_traits/dependent_type.h> #include <__utility/forward.h> #include <__utility/in_place.h> #include <__utility/move.h> 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 @@ -521,6 +521,7 @@ #include <__type_traits/aligned_union.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/aligned_union.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/apply_cv.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/apply_cv.h'}} +#include <__type_traits/can_extract_key.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/can_extract_key.h'}} #include <__type_traits/common_reference.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/common_reference.h'}} #include <__type_traits/common_type.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/common_type.h'}} #include <__type_traits/conditional.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/conditional.h'}} @@ -528,6 +529,7 @@ #include <__type_traits/copy_cv.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/copy_cv.h'}} #include <__type_traits/copy_cvref.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/copy_cvref.h'}} #include <__type_traits/decay.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/decay.h'}} +#include <__type_traits/dependent_type.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/dependent_type.h'}} #include <__type_traits/disjunction.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/disjunction.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'}} @@ -542,6 +544,7 @@ #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_char_like_type.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_char_like_type.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'}} @@ -559,6 +562,7 @@ #include <__type_traits/is_floating_point.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_floating_point.h'}} #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_implicitly_default_constructible.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_implicitly_default_constructible.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'}} @@ -590,6 +594,7 @@ #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_signed_integer.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_signed_integer.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_swappable.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_swappable.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_assignable.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_trivially_assignable.h'}} #include <__type_traits/is_trivially_constructible.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_trivially_constructible.h'}} @@ -609,20 +614,24 @@ #include <__type_traits/is_volatile.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_volatile.h'}} #include <__type_traits/lazy.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/lazy.h'}} #include <__type_traits/make_32_64_or_128_bit.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/make_32_64_or_128_bit.h'}} +#include <__type_traits/make_const_lvalue_ref.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/make_const_lvalue_ref.h'}} #include <__type_traits/make_signed.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/make_signed.h'}} #include <__type_traits/make_unsigned.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/make_unsigned.h'}} +#include <__type_traits/maybe_const.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/maybe_const.h'}} #include <__type_traits/nat.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/nat.h'}} #include <__type_traits/negation.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/negation.h'}} #include <__type_traits/promote.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/promote.h'}} #include <__type_traits/rank.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/rank.h'}} #include <__type_traits/remove_all_extents.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/remove_all_extents.h'}} #include <__type_traits/remove_const.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/remove_const.h'}} +#include <__type_traits/remove_const_ref.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/remove_const_ref.h'}} #include <__type_traits/remove_cv.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/remove_cv.h'}} #include <__type_traits/remove_cvref.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/remove_cvref.h'}} #include <__type_traits/remove_extent.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/remove_extent.h'}} #include <__type_traits/remove_pointer.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/remove_pointer.h'}} #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/result_of.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/result_of.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/type_list.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/type_list.h'}} #include <__type_traits/underlying_type.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/underlying_type.h'}} @@ -630,6 +639,7 @@ #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'}} +#include <__utility/convert_to_integral.h> // expected-error@*:* {{use of private header from outside its module: '__utility/convert_to_integral.h'}} #include <__utility/declval.h> // expected-error@*:* {{use of private header from outside its module: '__utility/declval.h'}} #include <__utility/exchange.h> // expected-error@*:* {{use of private header from outside its module: '__utility/exchange.h'}} #include <__utility/forward.h> // expected-error@*:* {{use of private header from outside its module: '__utility/forward.h'}} diff --git a/libcxx/test/libcxx/type_traits/convert_to_integral.pass.cpp b/libcxx/test/libcxx/type_traits/convert_to_integral.pass.cpp --- a/libcxx/test/libcxx/type_traits/convert_to_integral.pass.cpp +++ b/libcxx/test/libcxx/type_traits/convert_to_integral.pass.cpp @@ -16,6 +16,10 @@ // Test that the __convert_to_integral functions properly converts Tp to the // correct type and value for integral, enum and user defined types. +#include "test_macros.h" + +TEST_CLANG_DIAGNOSTIC_IGNORED("-Wprivate-header") +#include <__utility/convert_to_integral.h> #include #include #include @@ -23,8 +27,6 @@ #include "user_defined_integral.h" -#include "test_macros.h" - template struct EnumType { diff --git a/libcxx/test/std/algorithms/alg.modifying.operations/alg.swap/swap_ranges.pass.cpp b/libcxx/test/std/algorithms/alg.modifying.operations/alg.swap/swap_ranges.pass.cpp --- a/libcxx/test/std/algorithms/alg.modifying.operations/alg.swap/swap_ranges.pass.cpp +++ b/libcxx/test/std/algorithms/alg.modifying.operations/alg.swap/swap_ranges.pass.cpp @@ -16,6 +16,7 @@ #include #include #include +#include #include "test_macros.h" #include "test_iterators.h" diff --git a/libcxx/test/std/algorithms/ranges_robust_against_dangling.pass.cpp b/libcxx/test/std/algorithms/ranges_robust_against_dangling.pass.cpp --- a/libcxx/test/std/algorithms/ranges_robust_against_dangling.pass.cpp +++ b/libcxx/test/std/algorithms/ranges_robust_against_dangling.pass.cpp @@ -17,9 +17,11 @@ #include #include +#include #include #include #include +#include #include "test_iterators.h"