]> git.ipfire.org Git - thirdparty/gcc.git/commit
libstdc++: Fix forwarding in __take/drop_of_repeat_view [PR112453]
authorPatrick Palka <ppalka@redhat.com>
Thu, 9 Nov 2023 20:15:08 +0000 (15:15 -0500)
committerPatrick Palka <ppalka@redhat.com>
Thu, 9 Nov 2023 20:15:08 +0000 (15:15 -0500)
commitd63282fa5b587f1b994210212f236b998a332995
tree5c291893ef03e864697b68b34fccb61da5fe10e3
parent6c2ac6e9ce152e120f166866c5c77924c726db99
libstdc++: Fix forwarding in __take/drop_of_repeat_view [PR112453]

We need to respect the value category of the repeat_view passed to these
two functions when accessing the view's _M_value member.  This revealed
that the space-efficient partial specialization of __box lacks && overloads
of operator* to match those of the primary template (inherited from
std::optional).

PR libstdc++/112453

libstdc++-v3/ChangeLog:

* include/std/ranges (__detail::__box<_Tp>::operator*): Define
&& overloads as well.
(__detail::__take_of_repeat_view): Forward __r when accessing
its _M_value member.
(__detail::__drop_of_repeat_view): Likewise.
* testsuite/std/ranges/repeat/1.cc (test07): New test.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
libstdc++-v3/include/std/ranges
libstdc++-v3/testsuite/std/ranges/repeat/1.cc