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-03-27 13:47:30 +01:00
2025-01-02 11:59:57 +01:00
2025-01-02 11:59:57 +01:00
2025-05-22 14:20:35 +02:00
2025-01-02 11:59:57 +01:00
2025-02-22 21:20:19 +00:00
2025-01-10 21:06:21 +00:00
2025-06-06 09:52:31 +01:00
2025-06-06 09:52:31 +01:00
2025-01-02 11:59:57 +01:00
2025-01-02 11:59:57 +01:00
2025-06-02 18:24:30 +01:00
2025-04-15 09:24:58 +01:00
2025-05-29 11:49:03 +01:00
2025-01-02 11:59:57 +01:00
2025-06-04 14:55:40 -04:00
2025-04-29 10:52:59 +01:00
2025-01-02 11:59:57 +01:00
2025-07-18 15:29:01 +02:00
2025-06-04 20:15:44 +01:00
2025-01-02 11:59:57 +01:00
2025-01-02 11:59:57 +01:00
2025-04-15 09:24:58 +01:00
2025-07-11 08:34:17 +01:00
2025-06-02 13:52:35 +02:00
2025-04-11 13:56:03 +02:00
2025-01-02 11:59:57 +01:00
2025-01-02 11:59:57 +01:00
2025-01-02 11:59:57 +01:00
2025-06-12 18:29:37 +02:00
2025-04-11 13:56:03 +02:00
2025-01-02 11:59:57 +01:00
2025-01-02 11:59:57 +01:00
2025-01-02 11:59:57 +01:00
2025-01-02 11:59:57 +01:00
2025-01-02 11:59:57 +01:00
2025-01-02 11:59:57 +01:00
2025-06-02 13:52:35 +02:00
2025-01-02 11:59:57 +01:00
2025-07-15 10:25:34 +01:00
2025-06-02 13:52:35 +02:00
2025-01-02 11:59:57 +01:00
2025-01-02 11:59:57 +01:00
2025-02-25 22:27:14 +01:00
2025-03-18 15:12:53 +01:00
2025-01-02 11:59:57 +01:00
2025-08-04 13:19:24 +02:00
2025-01-02 11:59:57 +01:00
2025-01-02 11:59:57 +01:00
2025-01-02 11:59:57 +01:00
2025-07-11 08:34:13 +01:00
2025-01-02 11:59:57 +01:00
2025-01-02 11:59:57 +01:00
2025-01-08 12:45:37 +00:00
2025-04-29 10:52:59 +01:00
2025-01-02 11:59:57 +01:00
2025-03-19 23:29:06 +00:00
2025-01-02 11:59:57 +01:00
2025-01-02 11:59:57 +01:00
2025-01-02 11:59:57 +01:00
2025-01-02 11:59:57 +01:00
2025-07-11 08:34:13 +01:00
2025-01-02 11:59:57 +01:00
2025-01-02 11:59:57 +01:00
2025-06-02 13:52:35 +02:00
2025-01-02 11:59:57 +01:00
2025-07-15 20:31:48 +01:00
2025-01-02 11:59:57 +01:00
2025-01-02 11:59:57 +01:00
2025-01-02 11:59:57 +01:00
2025-04-29 10:52:59 +01:00
2025-01-02 11:59:57 +01:00
2024-09-25 08:20:45 -04:00
2025-01-02 11:59:57 +01:00
2025-01-02 11:59:57 +01:00
2025-01-02 11:59:57 +01:00
2025-05-06 17:19:25 +01:00
2025-01-02 11:59:57 +01:00
2025-01-02 11:59:57 +01:00
2025-04-29 10:52:59 +01:00
2025-02-15 10:58:56 +00:00
2025-07-06 14:49:34 -04:00
2025-02-28 21:35:27 +00:00
2025-07-15 20:31:47 +01:00
2025-01-02 11:59:57 +01:00
2025-07-15 10:25:48 +01:00
2025-03-12 10:12:36 +00:00
2025-01-02 11:59:57 +01:00
2025-01-02 11:59:57 +01:00
2025-01-02 11:59:57 +01:00
2025-04-29 19:54:35 +01:00
2025-04-29 19:54:35 +01:00
2025-01-02 11:59:57 +01:00
2025-01-02 11:59:57 +01:00
2025-01-02 11:59:57 +01:00
2025-04-29 19:54:35 +01:00
2025-01-02 11:59:57 +01:00
2025-01-02 11:59:57 +01:00
2025-01-08 12:45:37 +00:00
2025-01-02 11:59:57 +01:00
2024-09-25 08:20:45 -04:00
2025-06-06 20:15:07 +01:00
2025-01-02 11:59:57 +01:00
2025-07-09 12:14:40 +01:00
2025-07-09 12:14:40 +01:00
2025-01-02 11:59:57 +01:00
2025-01-02 11:59:57 +01:00
2025-01-02 11:59:57 +01:00
2025-05-27 12:11:43 +01:00
2025-04-29 10:52:59 +01:00
2025-01-02 11:59:57 +01:00
2025-01-02 11:59:57 +01:00
2025-06-12 18:41:30 +02:00
2025-07-11 08:34:17 +01:00
2025-04-11 13:56:03 +02:00
2025-06-11 10:35:27 +01:00
2025-06-02 18:24:30 +01:00
2025-01-02 11:59:57 +01:00
2025-01-02 11:59:57 +01:00
2025-07-28 17:04:04 +02:00
2025-07-19 00:10:10 +01:00
2025-07-07 21:50:51 +01:00
2025-04-11 13:56:03 +02:00
2025-04-29 15:08:53 +01:00
2025-04-11 13:56:03 +02:00
2025-04-11 13:56:03 +02:00
2025-01-02 11:59:57 +01:00
2025-07-14 21:41:37 +01:00
2025-04-25 13:02:04 +02:00
2025-01-02 11:59:57 +01:00
2025-01-02 11:59:57 +01:00
2025-04-29 15:08:53 +01:00
2025-04-25 13:02:04 +02:00
2025-06-12 18:41:30 +02:00
2025-04-29 15:08:53 +01:00
2025-07-09 17:56:22 +01:00
2025-06-03 10:53:00 +01:00
2025-01-02 11:59:57 +01:00
2025-01-02 11:59:57 +01:00
2025-01-02 11:59:57 +01:00
2025-01-02 11:59:57 +01:00
2025-01-02 11:59:57 +01:00
2024-03-19 15:20:07 +00:00
2025-01-02 11:59:57 +01:00
2025-04-11 08:43:50 +02:00
2025-07-18 10:29:58 +01:00
2025-04-29 10:52:59 +01:00
2025-03-06 16:46:19 +00:00
2025-07-14 21:41:37 +01:00
2025-07-25 14:29:02 +02:00
2025-04-28 10:09:26 +02:00
2025-01-02 11:59:57 +01:00
2025-01-02 11:59:57 +01:00
2025-05-26 11:25:28 +02:00
2025-01-02 11:59:57 +01:00
2025-04-29 10:52:59 +01:00
2025-01-02 11:59:57 +01:00
2025-01-02 11:59:57 +01:00
2025-06-03 10:53:00 +01:00
2025-07-18 09:49:34 +02:00
2025-07-18 09:49:34 +02:00
2025-04-04 09:58:54 +01:00