From: Jonathan Wakely <jwakely@redhat.com>
To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] libstdc++: Fix filesystem::path constraints for volatile [PR 100630]
Date: Mon, 17 May 2021 15:25:48 +0100 [thread overview]
Message-ID: <YKJ87HUdsGvh1fXV@redhat.com> (raw)
In-Reply-To: <YKJ3ZPcCmvVxIcTJ@redhat.com>
On 17/05/21 15:02 +0100, Jonathan Wakely wrote:
>The constraint check for filesystem::path construction uses
>decltype(__is_path_src(declval<Source>())) which mean it considers
>conversion from an rvalue. When Source is a volatile-qualified type
>it cannot use is_path_src(const Unknown&) because a const lvalue
>reference can only bind to a non-volatile rvalue.
>
>Since the relevant path members all have a const Source& parameter,
>the constraint should be defined in terms of declval<const Source&>(),
>not declval<Source>(). This avoids the problem of volatile-qualified
>rvalues, because we no longer use an rvalue at all.
>
>libstdc++-v3/ChangeLog:
>
> PR libstdc++/100630
> * include/bits/fs_path.h (__is_constructible_from): Test
> construction from a const lvalue, not an rvalue.
> * include/experimental/bits/fs_path.h (__is_constructible_from):
> Likewise.
> * testsuite/27_io/filesystem/path/construct/100630.cc: New test.
> * testsuite/experimental/filesystem/path/construct/100630.cc:
> New test.
>
>Tested x86_64-linux, pushed to gcc-10 (this isn't needed for gcc-11 or
>trunk, but I also plan to backport it to gcc-9).
Oh actually this is needed for experimental::filesystem::path on trun
kand gcc-11 (as I found when I added to the new tests to trunk) so
I'll fix it there too.
next prev parent reply other threads:[~2021-05-17 14:25 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-17 14:02 Jonathan Wakely
2021-05-17 14:25 ` Jonathan Wakely [this message]
2021-05-17 17:14 ` Jonathan Wakely
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=YKJ87HUdsGvh1fXV@redhat.com \
--to=jwakely@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=libstdc++@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: link
Be 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).