Jonathan Wakely c8a24f60b6 libstdc++: Fix std::get<T> for std::pair with reference members [PR121745]
Make the std::get<T> overloads for rvalues use std::forward<T>(p.first)
not std::move(p.first), so that lvalue reference members are not
incorrectly converted to rvalues.

It might appear that std::move(p).first would also work, but the
language rules say that for std::pair<T&&, U> that would produce T&
rather than the expected T&& (see the discussion in P2445R1 §8.2).

Additional tests are added to verify all combinations of reference
members, value categories, and const-qualification.

libstdc++-v3/ChangeLog:

	PR libstdc++/121745
	* include/bits/stl_pair.h (get): Use forward instead of move in
	std::get<T> overloads for rvalue pairs.
	* testsuite/20_util/pair/astuple/get_by_type.cc: Check all value
	categories and cv-qualification.

Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
2025-09-03 12:16:18 +01:00
2025-08-11 00:16:52 +00:00
2025-08-18 00:18:52 +00:00
2025-08-29 00:19:55 +00:00
2025-08-17 00:19:17 +00:00
2025-09-02 00:19:26 +00:00
2025-08-31 00:18:58 +00:00
2025-08-21 00:20:43 +00:00
2025-09-03 00:20:18 +00:00
2025-08-17 00:19:17 +00:00
2025-09-03 00:20:18 +00:00
2025-09-02 00:19:26 +00:00
2025-08-29 00:19:55 +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.7%
C 30.2%
Ada 14.4%
D 6.1%
Go 5.7%
Other 12.4%