From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 4806C385840E; Tue, 22 Nov 2022 21:49:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4806C385840E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1669153746; bh=v7tB/H4YexdTKvKzl0YPpjGSBieLoEVrJMnm+PRv+OI=; h=From:To:Subject:Date:In-Reply-To:References:From; b=t+RJPrBnoyOL9M1e+wdrPR3qPBGqcHDjhQhgg/WqrGvgt1aaMPQK8RFnHck9AkpIm nF6zmhW+0V5RoxWVW04giZM8jDykDcA0fQWfTzt45CZar+09vSDSVM1pl9LDBn0y3F /WTHeoMRz6p0/Nr1JUGuHqoW4klBJ6nyz8maAc3I= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/106201] filesystem::directory_iterator is a borrowable range? Date: Tue, 22 Nov 2022 21:49:06 +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: 13.0 X-Bugzilla-Keywords: rejects-valid 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: redi at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D106201 --- Comment #12 from CVS Commits --- The releases/gcc-12 branch has been updated by Jonathan Wakely : https://gcc.gnu.org/g:477b3f9d58589b3af7a5a7d038d78352ad66406e commit r12-8927-g477b3f9d58589b3af7a5a7d038d78352ad66406e Author: Jonathan Wakely Date: Tue Nov 22 18:15:56 2022 +0000 libstdc++: Add workaround for fs::path constraint recursion [PR106201] This works around a compiler bug where overload resolution attempts implicit conversion to path in order to call a function with a path& parameter. Such conversion would produce a prvalue, which would not be able to bind to the lvalue reference anyway. Attempting to check the conversion causes a constraint recursion because the arguments to the path constructor are checked to see if they're iterators, which checks if they're swappable, which tries to use the swap function that triggered the conversion in the first place. This replaces the swap function with an abbreviated function template that is constrained with same_as auto& so that the invalid conversion is never considered. libstdc++-v3/ChangeLog: PR libstdc++/106201 * include/bits/fs_path.h (filesystem::swap(path&, path&)): Replace with abbreviated function template. * include/experimental/bits/fs_path.h (filesystem::swap): Likewise. * testsuite/27_io/filesystem/iterators/106201.cc: New test. * testsuite/experimental/filesystem/iterators/106201.cc: New te= st.=