public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/109242] New: C++2b std::optional::transform omits required std::remove_cv_t from return optional type
@ 2023-03-21 23:31 pkasting at google dot com
  2023-03-21 23:40 ` [Bug libstdc++/109242] " redi at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: pkasting at google dot com @ 2023-03-21 23:31 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109242

            Bug ID: 109242
           Summary: C++2b std::optional::transform omits required
                    std::remove_cv_t from return optional type
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pkasting at google dot com
  Target Milestone: ---

The implementation of C++2b's std::optional::transform() on HEAD omits a call
to std::remove_cv_t when determining the value type of the returned optional.
As a result valid code such as the following example is rejected:
https://godbolt.org/z/hG5hnz59e

#include <optional>

struct S {
  int i;
};

void foo() {
  std::optional<S>().transform(&S::i);
}

Per https://en.cppreference.com/w/cpp/utility/optional/transform, the returned
type should always be computed via std::remove_cv_t<> on the invoke_result, but
per
https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=libstdc%2B%2B-v3/include/std/optional;hb=HEAD,
_Up consistently omits this.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-03-30  8:09 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-21 23:31 [Bug libstdc++/109242] New: C++2b std::optional::transform omits required std::remove_cv_t from return optional type pkasting at google dot com
2023-03-21 23:40 ` [Bug libstdc++/109242] " redi at gcc dot gnu.org
2023-03-22  2:53 ` rs2740 at gmail dot com
2023-03-22  3:02 ` pkasting at google dot com
2023-03-29 21:26 ` redi at gcc dot gnu.org
2023-03-29 23:45 ` cvs-commit at gcc dot gnu.org
2023-03-29 23:47 ` redi at gcc dot gnu.org
2023-03-30  8:08 ` cvs-commit at gcc dot gnu.org
2023-03-30  8:09 ` redi at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).