https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109340
--- Comment #1 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jonathan Wakely <r...@gcc.gnu.org>: https://gcc.gnu.org/g:31a909712014b75fc6ae2ca5eaa425f218bb5f32 commit r13-6934-g31a909712014b75fc6ae2ca5eaa425f218bb5f32 Author: Jonathan Wakely <jwak...@redhat.com> Date: Wed Mar 29 22:16:55 2023 +0100 libstdc++: Use std::remove_cv_t in std::optional::transform [PR109340] We need to strip cv-qualifiers from the result of the callable passed to std::optional::transform. For std::expected::transform and std::expected::transform_error I noticed we were stripping cv-qualifiers but were also incorrectly stripping references. libstdc++-v3/ChangeLog: PR libstdc++/109340 * include/std/expected (expected::transform): Use std::remove_cv_t instead of std::remove_cvref_t. (expected::transform_error): Likewise. (expected<cv void, E>::transform): Likewise. (expected<cv void, E>::transform_error): Likewise. * include/std/optional (transform): Use std::remove_cv_t. * testsuite/20_util/optional/monadic/pr109340.cc: New test.