From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id 426283893678 for ; Mon, 14 Jun 2021 14:20:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 426283893678 Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-496-5yAxLg26NOiSXQHq86GIxA-1; Mon, 14 Jun 2021 10:20:07 -0400 X-MC-Unique: 5yAxLg26NOiSXQHq86GIxA-1 Received: by mail-wm1-f70.google.com with SMTP id m33-20020a05600c3b21b02901a44b1d2d87so47263wms.3 for ; Mon, 14 Jun 2021 07:20:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=N19ImHm0UbXg6WxubHCqrH+u+OQc2xMthtou/D1GOT0=; b=aMU3rVNtKzxm74Xoz00ct6U/O7n+JozmHTV1/ReLoSwPev702f1fgClRb0t/P4NGTx AduAcIvR6UsarUa6/b0lBVM//Cj7WVQmyuA1d43TkR8l0cJUyPb4grrGMYeFjLVlI4hB ElQ2AMfuBkFl4txq+A2PnOwDCrwacOsfYCnQkUam7AcTMFX3ghA737uZTRrRUBk1UaU8 7qNN8XbNCtxbPdKwFrNCjk7v+1h4yJ9WjGGbCS7wmOac0xAxV8KjgHmEetsqm1EBvMMx OI9g3BZVpFrfPZuav6Ik7ZtumiW+EUlUrnrC3cDzenaEuykLkscAvkMBbSG7EiV5O5Wd bVig== X-Gm-Message-State: AOAM530pxr9ZInoHajnSe8UGhJbwXTmHZoFhQcrxAVHD307oil2Z+yXN /8bnvHdyMBHbILi5yY5uEUi8LlYO34szI8zDBEO0Ydo2k2VwSJp0xqqvlpCXLt+L57jP0dHh2KD JHIA0dSscjfUKkQsbH6i3RLJnleBbrfo= X-Received: by 2002:adf:906a:: with SMTP id h97mr19378378wrh.311.1623680406432; Mon, 14 Jun 2021 07:20:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzqvNx+Ih6mHJYuqb78J0LnS13RLi8LVes6yIbsf5E+wkey5UzTnOZgiQg+pO28V6EuI5XprK9HkXEJJojG0MY= X-Received: by 2002:adf:906a:: with SMTP id h97mr19378363wrh.311.1623680406250; Mon, 14 Jun 2021 07:20:06 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Jonathan Wakely Date: Mon, 14 Jun 2021 15:19:55 +0100 Message-ID: Subject: Re: [committed] libstdc++: Fix filesystem::path comparisons for C++23 To: Christophe Lyon Cc: "libstdc++" , gcc Patches X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: multipart/mixed; boundary="000000000000d8135605c4ba8d30" X-Spam-Status: No, score=-12.5 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_NUMSUBJECT, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=unavailable autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libstdc++@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++ mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Jun 2021 14:20:13 -0000 --000000000000d8135605c4ba8d30 Content-Type: text/plain; charset="UTF-8" On Mon, 14 Jun 2021 at 13:58, Christophe Lyon wrote: > > Hi Jonathan, > > On Fri, 11 Jun 2021 at 20:25, Jonathan Wakely via Gcc-patches > wrote: > > > > In C++23 there is a basic_string_view(Range&&) constructor, which is > > constrained to take a range (specifically, a contiguous_range). When the > > filesystem::path comparison operators call lhs.compare(rhs) the overload > > taking a string_view is considered, which means checking whether path > > satisfies the range concept. That satisfaction result changes depending > > whether path::iterator is complete, which is ill-formed; no diagnostic > > required. To avoid the problem, this change ensures that the overload > > resolution is performed in a context where path::iterator is complete > > and the range concept is satisfied. (The result of overload resolution > > is always that the compare(const path&) overload is the best match, but > > we still have to consider the compare(basic_string_view) one > > to decide if it even participates in overload resolution). > > > > For std::filesystem::path we can't define the comparison operators later > > in the file, because they are hidden friends, so a new helper is > > introduced that gets defined when everything else is complete. > > > > For std::experimental::filesystem::path we can just move the definitions > > of the comparison operators later in the file. > > > > Signed-off-by: Jonathan Wakely > > > > libstdc++-v3/ChangeLog: > > > > * include/bits/fs_path.h (operator==, operator<=>): Use new > > _S_compare function. > > (path::_S_compare): New function to call path::compare in a > > context where path::iterator is complete. > > * include/experimental/bits/fs_path.h (operator<, operator==): > > Define after path::iterator is complete. > > * testsuite/27_io/filesystem/path/native/conv_c++23.cc: New > > test. > > * testsuite/experimental/filesystem/path/native/conv_c++23.cc: > > New test. > > > > Tested powerpc64le-linux. Committed to trunk. > > > > This also needs to be backported to gcc-11 where the string_view > > constructor is present for C++23 mode. > > > > The new test experimental/filesystem/path/native/conv_c++23.cc > fails on arm-eabi and aarch64-elf: > /libstdc++-v3/testsuite/experimental/filesystem/path/native/conv_c++23.cc:4: > fatal error: experimental/filesystem: No such file or directory > (both trunk and gcc-11) > > I guess that's easy to fix? :-) Yes, fixed on trunk now by the attached patch. Tests running for the gcc-11 backport. --000000000000d8135605c4ba8d30 Content-Type: text/plain; charset="US-ASCII"; name="patch.txt" Content-Disposition: attachment; filename="patch.txt" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_kpwpdn370 Y29tbWl0IGE0MGQyMjkzYTdhNDE3ZmM3NzExZjhmNGU1MmRiZDRjNDhjMmE0M2YKQXV0aG9yOiBK b25hdGhhbiBXYWtlbHkgPGp3YWtlbHlAcmVkaG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