[Bug libstdc++/109242] C++2b std::optional::transform omits required std::remove_cv_t from return optional type
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109242 Jonathan Wakely changed: What|Removed |Added Last reconfirmed||2023-03-21 Ever confirmed|0 |1 Status|UNCONFIRMED |NEW
[Bug libstdc++/109242] C++2b std::optional::transform omits required std::remove_cv_t from return optional type
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109242 TC changed: What|Removed |Added CC||rs2740 at gmail dot com --- Comment #1 from TC --- The missing remove_cv_t is real, but this example is invalid. As the linked cppreference page notes, you cannot pass a PMD to transform.
[Bug libstdc++/109242] C++2b std::optional::transform omits required std::remove_cv_t from return optional type
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109242 --- Comment #2 from Peter Kasting --- (In reply to TC from comment #1) > The missing remove_cv_t is real, but this example is invalid. As the linked > cppreference page notes, you cannot pass a PMD to transform. Ah, true! How about this then: https://godbolt.org/z/TaccPEsY1 #include struct S { int& i() const; }; void foo() { std::optional().transform(&S::i); }
[Bug libstdc++/109242] C++2b std::optional::transform omits required std::remove_cv_t from return optional type
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109242 Jonathan Wakely changed: What|Removed |Added Keywords||wrong-code Assignee|unassigned at gcc dot gnu.org |redi at gcc dot gnu.org Status|NEW |ASSIGNED --- Comment #3 from Jonathan Wakely --- (In reply to Peter Kasting from comment #2) > struct S { > int& i() const; > }; > > void foo() { > std::optional().transform(&S::i); The U type is a reference here, which isn't allowed. This shows the bug: struct A { }; const A f(int); std::optional o; A&& p = *o.transform(f);
[Bug libstdc++/109242] C++2b std::optional::transform omits required std::remove_cv_t from return optional type
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109242 --- Comment #4 from CVS Commits --- The master branch has been updated by Jonathan Wakely : https://gcc.gnu.org/g:ee122a2eeaea2ffec0e32577c7372bd4e2289e11 commit r13-6937-gee122a2eeaea2ffec0e32577c7372bd4e2289e11 Author: Jonathan Wakely Date: Thu Mar 30 00:42:11 2023 +0100 libstdc++: Fix filename of new test [PR109242] libstdc++-v3/ChangeLog: PR libstdc++/109242 * testsuite/20_util/optional/monadic/pr109340.cc: Moved to... * testsuite/20_util/optional/monadic/pr109242.cc: ...here.
[Bug libstdc++/109242] C++2b std::optional::transform omits required std::remove_cv_t from return optional type
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109242 Jonathan Wakely changed: What|Removed |Added Target Milestone|--- |12.3 --- Comment #5 from Jonathan Wakely --- Fixed on trunk by commit r13-6934-g31a909712014b75fc6ae2ca5eaa425f218bb5f32 I'll backport to gcc-12 too.
[Bug libstdc++/109242] C++2b std::optional::transform omits required std::remove_cv_t from return optional type
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109242 --- Comment #6 from CVS Commits --- The releases/gcc-12 branch has been updated by Jonathan Wakely : https://gcc.gnu.org/g:82e8d1685a1e5fac4880e987ed9684248378bce2 commit r12-9369-g82e8d1685a1e5fac4880e987ed9684248378bce2 Author: Jonathan Wakely Date: Wed Mar 29 22:16:55 2023 +0100 libstdc++: Use std::remove_cv_t in std::optional::transform [PR109242] We need to strip cv-qualifiers from the result of the callable passed to std::optional::transform. libstdc++-v3/ChangeLog: PR libstdc++/109242 * include/std/optional (transform): Use std::remove_cv_t. * testsuite/20_util/optional/monadic/pr109242.cc: New test. (cherry picked from commit 31a909712014b75fc6ae2ca5eaa425f218bb5f32)
[Bug libstdc++/109242] C++2b std::optional::transform omits required std::remove_cv_t from return optional type
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109242 Jonathan Wakely changed: What|Removed |Added Status|ASSIGNED|RESOLVED Resolution|--- |FIXED --- Comment #7 from Jonathan Wakely --- Fixed for 12.3, thanks for the report.