public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/100479] range adaptors handle cached iterators incorrectly Date: Mon, 24 May 2021 19:24:53 +0000 [thread overview] Message-ID: <bug-100479-4-FLmgHHjytA@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-100479-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100479 --- Comment #1 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>: https://gcc.gnu.org/g:46ed811bcb4b86a81ef3d78ea8cfffc6cd043144 commit r12-1018-g46ed811bcb4b86a81ef3d78ea8cfffc6cd043144 Author: Patrick Palka <ppalka@redhat.com> Date: Mon May 24 15:24:44 2021 -0400 libstdc++: Fix iterator caching inside range adaptors [PR100479] This fixes two issues with our iterator caching as described in detail in the PR. Since we recently added the __non_propagating_cache class template as part of r12-336 for P2328, this patch just rewrites the problematic _CachedPosition partial specialization in terms of this class template. For the offset partial specialization, it's safe to propagate the cached offset on copy/move, but we should still invalidate the cached offset in the source object on move. libstdc++-v3/ChangeLog: PR libstdc++/100479 * include/std/ranges (__detail::__non_propagating_cache): Move definition up to before that of _CachedPosition. Make base class _Optional_base protected instead of private. Add const overload for operator*. (__detail::_CachedPosition): Rewrite the partial specialization for forward ranges as a derived class of __non_propagating_cache. Remove the size constraint on the partial specialization for random access ranges. Add copy/move/copy-assignment/move-assignment members to the offset partial specialization for random access ranges that propagate the cached value but additionally invalidate it in the source object on move. * testsuite/std/ranges/adaptors/100479.cc: New test.
next prev parent reply other threads:[~2021-05-24 19:24 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-05-07 23:04 [Bug libstdc++/100479] New: " rs2740 at gmail dot com 2021-05-07 23:09 ` [Bug libstdc++/100479] " redi at gcc dot gnu.org 2021-05-11 15:28 ` ppalka at gcc dot gnu.org 2021-05-24 19:24 ` cvs-commit at gcc dot gnu.org [this message] 2021-05-28 14:21 ` cvs-commit at gcc dot gnu.org 2021-10-12 19:00 ` ppalka at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-100479-4-FLmgHHjytA@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).