From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 62238396DC0F; Tue, 31 May 2022 18:39:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 62238396DC0F From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/103904] [defect fix] Please backport P2325R3 to 10 and 11 Date: Tue, 31 May 2022 18:39:40 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 11.2.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: ppalka at gcc dot gnu.org X-Bugzilla-Target-Milestone: 10.4 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 May 2022 18:39:41 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D103904 --- Comment #16 from CVS Commits --- The releases/gcc-10 branch has been updated by Patrick Palka : https://gcc.gnu.org/g:22b86cdc4d7fddb4991a08515e47e66fe5c41def commit r10-10808-g22b86cdc4d7fddb4991a08515e47e66fe5c41def Author: Patrick Palka Date: Tue May 31 14:38:11 2022 -0400 libstdc++: Implement P2325 changes to default-constructibility of views NB: This backport of r12-1606 to the 10 branch deliberately omits parts of P2325R3 so as to maximize backward compatibility with pre-P2325R3 co= de. In particular, we don't remove the default ctors for back_insert_iterat= or, front_insert_iterator, ostream_iterator, ref_view and basic_istream_vie= w. And in the 10 branch we we don't have __non_propagating_cache or the partial specialization of __box, so the changes to them are omitted too. Finally, we don't update __cpp_lib_ranges to 202106L because many significant 202106 Ranges changes still aren't implemented in the 10 branch, e.g. P2281R1 and P2210R2. =3D=3D=3D This implements the wording changes of P2325R3 "Views should not be required to be default constructible". Changes are relatively straightforward, besides perhaps those to __box (which now stands for copyable-box instead of semiregular-box) and __non_propagating_cach= e. For __box, this patch implements the recommended practice to also avoid std::optional when the boxed type is nothrow_move/copy_constructible. For __non_propagating_cache, now that it's used by split_view::_M_curre= nt, we need to add assignment from a value of the underlying type to the subset of the std::optional API implemented for the cache (needed by split_view::begin()). Hence the new __non_propagating_cache::operator= =3D overload. In passing, this fixes the undesirable list-init in the constructors of the partial specialization of __box as reported in PR100475 comment #7. PR libstdc++/103904 libstdc++-v3/ChangeLog: * include/bits/iterator_concepts.h (weakly_incrementable): Remo= ve default_initializable requirement. * include/bits/stl_iterator.h (common_iterator): Constrain the default ctor. (counted_iterator): Likewise. * include/std/ranges (ranges::view): Remove default_initializab= le requirement. (subrange): Constrain the default ctor. (__detail::__box::operator=3D): Handle self-assignment. (single_view): Constraint the default ctor. (iota_view): Relax semiregular constraint to copyable. Constrain the default ctor. (iota_view::_Iterator): Constraint the default ctor. (filter_view): Likewise. (filter_view::_Iterator): Likewise. (transform_view): Likewise. (transform_view::_Iterator): Likewise. (take_view): Likewise. (take_view::_Iterator): Likewise. (take_while_view): Likewise. (take_while_view::_Iterator): Likewise. (drop_while_view): Likewise. (drop_while_view::_Iterator): Likewise. (join_view): Likewise. (split_view): Constrain the default ctor. (common_view): Likewise. (reverse_view): Likewise. (elements_view): Likewise. (elements_view::_Iterator): Likewise. * include/std/span (enable_view>): Define this partial specialization to true unconditionally. * testsuite/std/ranges/p2325.cc: New test. * testsuite/std/ranges/single_view.cc (test06): New test. * testsuite/std/ranges/view.cc: Adjust now that view doesn't require default_initializable. (cherry picked from commit 4b4f5666b4c2f3aab2a9f3d53d394e390b9b682d)=