diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2025-09-01 18:12:27 +0100 |
---|---|---|
committer | Jonathan Wakely <redi@gcc.gnu.org> | 2025-09-03 12:16:18 +0100 |
commit | c8a24f60b6874fca4fb3adb153f8d5f1dd72b951 (patch) | |
tree | 3d31b5bc7b71c6dc4b11e92ab823a6b9e2e7e708 /libgomp/testsuite/libgomp.fortran/task3.f90 | |
parent | dd6fe9f5575ca01842e1809dd765bda7b1e8140e (diff) | |
download | gcc-c8a24f60b6874fca4fb3adb153f8d5f1dd72b951.zip gcc-c8a24f60b6874fca4fb3adb153f8d5f1dd72b951.tar.gz gcc-c8a24f60b6874fca4fb3adb153f8d5f1dd72b951.tar.bz2 |
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>
Diffstat (limited to 'libgomp/testsuite/libgomp.fortran/task3.f90')
0 files changed, 0 insertions, 0 deletions