https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112453
--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Patrick Palka <ppa...@gcc.gnu.org>: https://gcc.gnu.org/g:d63282fa5b587f1b994210212f236b998a332995 commit r14-5297-gd63282fa5b587f1b994210212f236b998a332995 Author: Patrick Palka <ppa...@redhat.com> Date: Thu Nov 9 15:15:08 2023 -0500 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 <jwak...@redhat.com>