Files
gcc/libstdc++-v3
Tomasz Kamiński d49d359b0c libstdc++: Fix dereferencing of std::indirect xvalues [PR121128]
Forr rvalues the _Self parameter deduces a non-reference type. Consequently,
((_Self)__self) moved the object to a temporary, which then destroyed on
function exit.

This patch fixes this by using a C-style cast __self to (const indirect&).
This not only resolves the above issue but also correctly handles types that
are derived (publicly and privately) from indirect. Allocator requirements in
[allocator.requirements.general] p22 guarantee that dereferencing const _M_objp
works with equivalent semantics to dereferencing _M_objp.

	PR libstdc++/121128

libstdc++-v3/ChangeLog:

	* include/bits/indirect.h (indirect::operator*):
	Cast __self to approparietly qualified indirect.
	* testsuite/std/memory/indirect/access.cc: New test.
	* testsuite/std/memory/polymorphic/access.cc: New test.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
2025-08-04 13:19:24 +02:00
..
2025-08-04 00:17:36 +00:00

file: libstdc++-v3/README

New users may wish to point their web browsers to the file
index.html in the 'doc/html' subdirectory.  It contains brief
building instructions and notes on how to configure the library in
interesting ways.