From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 0C4143858C1F; Tue, 22 Nov 2022 12:33:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0C4143858C1F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1669120386; bh=1jSgrCv5hG5L4kgRfk/B6n391ztuH4ZgFNSMS6Jp2Wc=; h=From:To:Subject:Date:In-Reply-To:References:From; b=enwpXYzCoMW4BDJVpUrbJMNfqrFEDz1jTseRZyVAIRlGQ+kBSS/58ywVDTWvfUOjL 7gsa0vQxhjPVGdfdtHszJhe7Pb5OII4Pi+Uo6Nf4069mlLVQvZLJi6geb9hBpDY1C9 wBP6dNFtXyGzp1gsMzcufI2SbQt921j+O/3sqJs4= From: "redi 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 12:33:04 +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: redi 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 #10 from Jonathan Wakely --- I'm planning to use this workaround for gcc-11 and gcc-12: --- a/libstdc++-v3/include/bits/fs_path.h +++ b/libstdc++-v3/include/bits/fs_path.h @@ -737,7 +737,14 @@ namespace __detail /// @{ /// @relates std::filesystem::path +#if __cpp_concepts >=3D 201907L + // Workaround for PR libstdc++/106201 + inline void + swap(same_as auto& __lhs, same_as auto& __rhs) noexcept + { __lhs.swap(__rhs); } +#else inline void swap(path& __lhs, path& __rhs) noexcept { __lhs.swap(__rhs);= } +#endif size_t hash_value(const path& __p) noexcept; This will prevent that swap overload from being a candidate for swapping counted_iterator, so we won't check for conversion to path& and hit the constraint recursion.=