gcc/libstdc++-v3/include
Jonathan Wakely 33ed110858 libstdc++: Include std::ranges::subrange definition in <tuple> [PR102301]
In order for std::make_from_tuple to work with tuple-like types, the
overloads of std::get for those types must have been declared before the
definition of std::make_from_tuple. That means we need to include the
definition of std::ranges::subrange in <tuple>.

The definitions of std::pair and its overloads of std::get are already
included in <tuple>. We provide forward declarations of std::array and
its std::get overloads in <tuple>. We could just declare subrange
without defining it, and give ranges::get a non-deduced return type,
like so:

  namespace ranges
  {
    enum class subrange_kind : bool { unsized, sized};

    template<input_or_output_iterator I, sentinel_for<I> S,
	     subrange_kind K>
      requires (K == subrange_kind::sized || !sized_sentinel_for<S, I>)
      class subrange;

    template<size_t _Num, class _It, class _Sent, subrange_kind _Kind>
      requires (_Num < 2)
      constexpr __conditional_t<_Num == 0, _It, _Sent>
      get(const subrange<_It, _Sent, _Kind>& __r);

    template<size_t _Num, class _It, class _Sent, subrange_kind _Kind>
      requires (_Num < 2)
      constexpr __conditional_t<_Num == 0, _It, _Sent>
      get(subrange<_It, _Sent, _Kind>&& __r)
  }
  using ranges::get;

It is a bit late in the GCC 13 dev cycle to do this, so just include the
right headers for now.

Also add the dangling check to std::make_from_tuple added by P2255.

libstdc++-v3/ChangeLog:

	PR libstdc++/102301
	* include/bits/ranges_base.h: Include <bits/stl_iterator.h> for
	std::make_reverse_iterator.
	* include/std/tuple: Include <bits/ranges_util.h> for subrange.
	(make_from_tuple): Add static assertion from P2255 to diagnose
	dangling references.
	* testsuite/20_util/tuple/make_from_tuple/dangling_ref.cc: New test.
	* testsuite/20_util/tuple/make_from_tuple/tuple_like.cc: New test.
2023-01-24 23:46:42 +00:00
..
backward Update copyright years. 2023-01-16 11:52:17 +01:00
bits libstdc++: Include std::ranges::subrange definition in <tuple> [PR102301] 2023-01-24 23:46:42 +00:00
c Update copyright years. 2023-01-16 11:52:17 +01:00
c_compatibility Update copyright years. 2023-01-16 11:52:17 +01:00
c_global Update copyright years. 2023-01-16 11:52:17 +01:00
c_std Update copyright years. 2023-01-16 11:52:17 +01:00
debug libstdc++: [_GLIBCXX_DEBUG] Remove useless constructor checks 2023-01-23 19:11:54 +01:00
decimal Update copyright years. 2023-01-16 11:52:17 +01:00
experimental Update copyright years. 2023-01-16 11:52:17 +01:00
ext Update copyright years. 2023-01-16 11:52:17 +01:00
parallel Update copyright years. 2023-01-16 11:52:17 +01:00
precompiled Update copyright years. 2023-01-16 11:52:17 +01:00
pstl libstdc++: Declare const global variables inline 2022-11-06 11:30:47 -05:00
std libstdc++: Include std::ranges::subrange definition in <tuple> [PR102301] 2023-01-24 23:46:42 +00:00
tr1 Update copyright years. 2023-01-16 11:52:17 +01:00
tr2 Update copyright years. 2023-01-16 11:52:17 +01:00
Makefile.am Update copyright years. 2023-01-16 11:52:17 +01:00
Makefile.in libstdc++: Enable string_view in freestanding 2023-01-13 13:34:21 +00:00