]> gcc.gnu.org Git - gcc.git/commit
libstdc++: Fix filesystem::path constraints for volatile [PR 100630]
authorJonathan Wakely <jwakely@redhat.com>
Mon, 17 May 2021 10:54:06 +0000 (11:54 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Mon, 17 May 2021 20:52:19 +0000 (21:52 +0100)
commitf8d2cef5c544dd0196ec5a6f479fbf96d2214d76
tree056ae0a1c6130e16bb882c7c06d666536f0ab530
parent2b5718610016b4c12cadc6f67be94b6020e68b8f
libstdc++: Fix filesystem::path constraints for volatile [PR 100630]

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/experimental/bits/fs_path.h (__is_constructible_from):
Test construction from a const lvalue, not an rvalue.
* testsuite/27_io/filesystem/path/construct/100630.cc: New test.
* testsuite/experimental/filesystem/path/construct/100630.cc:
New test.

(cherry picked from commit 45aa7a447652e8541cc381d7ab128544f81ed857)
libstdc++-v3/include/experimental/bits/fs_path.h
libstdc++-v3/testsuite/27_io/filesystem/path/construct/100630.cc [new file with mode: 0644]
libstdc++-v3/testsuite/experimental/filesystem/path/construct/100630.cc [new file with mode: 0644]
This page took 0.061734 seconds and 6 git commands to generate.