public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/100287] New: Using iterator after std::move in ranges::partition
@ 2021-04-27 10:18 hewillk at gmail dot com
  2021-04-27 13:41 ` [Bug libstdc++/100287] " ppalka at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: hewillk at gmail dot com @ 2021-04-27 10:18 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 100287
           Summary: Using iterator after std::move in ranges::partition
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hewillk at gmail dot com
  Target Milestone: ---

Hi, in ranges::partition in ranges_algo.h#L2540:

  if (__first == __last)
    return {std::move(__first), std::move(__first)};

  while (std::__invoke(__pred, std::__invoke(__proj, *__first)))
    if (++__first == __last)
      return {std::move(__first), std::move(__first)};

The above two return statements std::move on __first twice. If the previous one
changes the original state of the __first, it may cause a problem.

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

end of thread, other threads:[~2021-10-13 13:59 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-27 10:18 [Bug libstdc++/100287] New: Using iterator after std::move in ranges::partition hewillk at gmail dot com
2021-04-27 13:41 ` [Bug libstdc++/100287] " ppalka at gcc dot gnu.org
2021-04-28  3:23 ` cvs-commit at gcc dot gnu.org
2021-10-13 13:52 ` cvs-commit at gcc dot gnu.org
2021-10-13 13:56 ` cvs-commit at gcc dot gnu.org
2021-10-13 13:59 ` ppalka 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).