libstdc++: Use std::remove_cv_t in std::optional::transform [PR109340]
authorJonathan Wakely <jwakely@redhat.com>
Wed, 29 Mar 2023 21:16:55 +0000 (22:16 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Wed, 29 Mar 2023 23:06:25 +0000 (00:06 +0100)
commit31a909712014b75fc6ae2ca5eaa425f218bb5f32
tree21d654fbcbcaf03eed0bc8422388f48154714d2b
parent14f50ba054079eccf9ac49997b92793e2a87b13c
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.
libstdc++-v3/include/std/expected
libstdc++-v3/include/std/optional
libstdc++-v3/testsuite/20_util/optional/monadic/pr109340.cc [new file with mode: 0644]