Tomasz Kamiński 490eca9b76 libsdc++: Restore check for validity of std::get for elements_view.
Resolves LWG3797, "elements_view insufficiently constrained".

When P2165R4 updated __has_tuple_element in C++23 to reuse __tuple_like
concept, it dropped the requirement of validity of get, assuming that for
tuple_like type with size of N, get<I> on lvalue is well-formed for any I < N.
This however does not hold for ranges::subrange (tuple-like of size 2) with
move-only iterator, for which get can only be applied on rvalue. In consequence
constrains allowed instantiating elements_view for range of such subrange,
but instantiating it's iterator lead to hard error from iterator_category
computation.

This patch applies the requirements on validity of get also in C++23 and
later standard modes.

libstdc++-v3/ChangeLog:

	* include/std/ranges (__detail::__has_tuple_element): Check
	if std::get<_Nm>(__t) returns referenceable type also for C++23
	and later.
	* testsuite/std/ranges/adaptors/elements.cc: Add test covering
	vector of ranges::subrange with move-only iterator.

Reviewed-by: Patrick Palka <ppalka@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
2026-04-24 16:59:38 +02:00
2026-04-15 08:16:45 +00:00
2026-04-23 00:16:32 +00:00
2026-04-22 00:16:28 +00:00
2026-04-24 00:16:27 +00:00
2026-04-18 00:16:31 +00:00
2026-04-22 00:16:28 +00:00
2026-04-18 00:16:31 +00:00
2026-04-22 00:16:28 +00:00
2026-04-22 00:16:28 +00:00
2026-04-23 00:16:32 +00:00

This directory contains the GNU Compiler Collection (GCC).

The GNU Compiler Collection is free software.  See the files whose
names start with COPYING for copying permission.  The manuals, and
some of the runtime libraries, are under different terms; see the
individual source files for details.

The directory INSTALL contains copies of the installation information
as HTML and plain text.  The source of this information is
gcc/doc/install.texi.  The installation information includes details
of what is included in the GCC sources and what files GCC installs.

See the file gcc/doc/gcc.texi (together with other files that it
includes) for usage and porting information.  An online readable
version of the manual is in the files gcc/doc/gcc.info*.

See http://gcc.gnu.org/bugs/ for how to report bugs usefully.

Copyright years on GCC source files may be listed using range
notation, e.g., 1987-2012, indicating that every year in the range,
inclusive, is a copyrightable year that could otherwise be listed
individually.
Description
No description provided
Readme 4.2 GiB
Languages
C++ 30.8%
C 30.2%
Ada 14.4%
D 6.1%
Go 5.7%
Other 12.3%