diff options
author | Jason Merrill <jason@redhat.com> | 2024-11-20 00:21:00 +0100 |
---|---|---|
committer | Jason Merrill <jason@redhat.com> | 2024-11-27 08:25:23 -0500 |
commit | 21954a58ce408519b03e314f56204b49c5b310ba (patch) | |
tree | bdfafa77da8c9b182d602b9a310f59ec4c9d5dc9 | |
parent | e7aa614d7372b5d3cbcd2400838c80ef905ba381 (diff) | |
download | gcc-21954a58ce408519b03e314f56204b49c5b310ba.zip gcc-21954a58ce408519b03e314f56204b49c5b310ba.tar.gz gcc-21954a58ce408519b03e314f56204b49c5b310ba.tar.bz2 |
libstdc++: module std fixes
Some tests were failing due to the exported using declaration of iter_move
conflicting with friend declarations; the exported using needs to be in the
inline namespace, like the customization point itself, rather than
std::ranges.
Also add a few missing exports.
Some tests failed to find some operators defined in implementation-detail
namespaces; this exports them as well, but as previously discussed it's
probably preferable to make those operators friends so ADL can find them
that way.
libstdc++-v3/ChangeLog:
* src/c++23/std.cc.in: Fix iter_move/swap. Add fold_left_first, to,
concat, and some operators.
-rw-r--r-- | libstdc++-v3/src/c++23/std.cc.in | 64 |
1 files changed, 36 insertions, 28 deletions
diff --git a/libstdc++-v3/src/c++23/std.cc.in b/libstdc++-v3/src/c++23/std.cc.in index d225c8b..7d787a5 100644 --- a/libstdc++-v3/src/c++23/std.cc.in +++ b/libstdc++-v3/src/c++23/std.cc.in @@ -494,8 +494,13 @@ export namespace std #endif #if __cpp_lib_ranges_fold using ranges::fold_left; + using ranges::fold_left_first; + using ranges::fold_left_first_with_iter; using ranges::fold_left_with_iter; using ranges::fold_right; + using ranges::fold_right_last; + using ranges::in_value_result; + using ranges::out_value_result; #endif #if __cpp_lib_ranges_find_last using ranges::find_last; @@ -1572,10 +1577,14 @@ export namespace std using std::iter_reference_t; using std::iter_value_t; using std::iterator_traits; - namespace ranges + // _Cpo is an implementation detail we can't avoid exposing; if we do the + // using in ranges directly, it conflicts with any friend functions of the + // same name, which is why the customization points are in an inline + // namespace in the first place. + namespace ranges::inline _Cpo { - using std::ranges::iter_move; - using std::ranges::iter_swap; + using _Cpo::iter_move; + using _Cpo::iter_swap; } using std::advance; using std::bidirectional_iterator; @@ -1679,6 +1688,15 @@ export namespace std using std::make_const_sentinel; #endif } +// FIXME these should be friends of __normal_iterator to avoid exporting +// __gnu_cxx. +export namespace __gnu_cxx +{ + using __gnu_cxx::operator==; + using __gnu_cxx::operator<=>; + using __gnu_cxx::operator+; + using __gnu_cxx::operator-; +} // <latch> export namespace std @@ -2278,43 +2296,32 @@ export namespace std namespace views = ranges::views; using std::tuple_element; using std::tuple_size; -#if __glibcxx_ranges_as_const // >= C++23 namespace ranges { +#if __glibcxx_ranges_as_const // >= C++23 using ranges::constant_range; using ranges::const_iterator_t; using ranges::const_sentinel_t; using ranges::range_const_reference_t; using ranges::as_const_view; namespace views { using views::as_const; } - } #endif #ifdef __glibcxx_generator // C++ >= 23 && __glibcxx_coroutine - namespace ranges - { using ranges::elements_of; - } #endif #ifdef __cpp_lib_ranges_as_rvalue // C++ >= 23 - namespace ranges { using ranges::as_rvalue_view; namespace views { using views::as_rvalue; } - } #endif #ifdef __cpp_lib_ranges_chunk // C++ >= 23 - namespace ranges { using ranges::chunk_view; namespace views { using views::chunk; } - } #endif #ifdef __cpp_lib_ranges_slide // C++ >= 23 - namespace ranges { using ranges::slide_view; namespace views { using views::slide; } - } #endif #ifdef __cpp_lib_ranges_zip // C++ >= 23 - namespace ranges { using ranges::zip_view; using ranges::zip_transform_view; using ranges::adjacent_view; @@ -2327,44 +2334,45 @@ export namespace std using views::pairwise; using views::pairwise_transform; } - } #endif #ifdef __cpp_lib_ranges_chunk_by // C++ >= 23 - namespace ranges { using ranges::chunk_by_view; namespace views { using views::chunk_by; } - } #endif #ifdef __cpp_lib_ranges_join_with // C++ >= 23 - namespace ranges { using ranges::join_with_view; namespace views { using views::join_with; } - } #endif #ifdef __cpp_lib_ranges_repeat // C++ >= 23 - namespace ranges { using ranges::repeat_view; namespace views { using views::repeat; } - } #endif #ifdef __cpp_lib_ranges_stride // C++ >= 23 - namespace ranges { using ranges::stride_view; namespace views { using views::stride; } - } #endif #ifdef __cpp_lib_ranges_cartesian_product // C++ >= 23 - namespace ranges { using ranges::cartesian_product_view; namespace views { using views::cartesian_product; } - } #endif #ifdef __cpp_lib_ranges_enumerate // C++ >= 23 - namespace ranges { using ranges::enumerate_view; namespace views { using views::enumerate; } - } #endif +#if __cpp_lib_ranges_to_container // C++ >= 23 + using ranges::to; +#endif // __cpp_lib_ranges_to_container +#if __cpp_lib_ranges_concat // C++ >= C++26 + using ranges::concat_view; + namespace views { using views::concat; } +#endif + + // FIXME can we avoid this export using friends? + namespace views::__adaptor + { + using __adaptor::operator|; + } + } } // <ratio> |