From: Jonathan Wakely Date: Wed, 15 May 2019 19:34:59 +0000 (+0100) Subject: PR libstdc++/90454.cc path construction from void* X-Git-Tag: releases/gcc-9.2.0~364 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b6721f2c477e5a48f647edaf74bb87d867f7e1ed;p=thirdparty%2Fgcc.git PR libstdc++/90454.cc path construction from void* Make the filesystem::path constructors SFINAE away for void* arguments, instead of giving an error due to iterator_traits::reference. Backport from mainline 2019-05-13 Jonathan Wakely PR libstdc++/90454.cc path construction from void* * include/bits/fs_path.h (path::_Path): Use remove_pointer so that pointers to void are rejected as well as void. * include/experimental/bits/fs_path.h (path::_Path): Likewise. * testsuite/27_io/filesystem/path/construct/80762.cc: Also check pointers to void. * testsuite/experimental/filesystem/path/construct/80762.cc: Likewise. From-SVN: r271262 --- diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 16635157db50..a1ff4a0011ea 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,16 @@ +2019-05-15 Jonathan Wakely + + Backport from mainline + 2019-05-13 Jonathan Wakely + + PR libstdc++/90454.cc path construction from void* + * include/bits/fs_path.h (path::_Path): Use remove_pointer so that + pointers to void are rejected as well as void. + * include/experimental/bits/fs_path.h (path::_Path): Likewise. + * testsuite/27_io/filesystem/path/construct/80762.cc: Also check + pointers to void. + * testsuite/experimental/filesystem/path/construct/80762.cc: Likewise. + 2019-05-13 Edward Smith-Rowland <3dw4rd@verizon.net> * doc/xml/manual/status_cxx2020.xml: Document P0811R3 status. diff --git a/libstdc++-v3/include/bits/fs_path.h b/libstdc++-v3/include/bits/fs_path.h index 3674b4391f80..ecef19e361be 100644 --- a/libstdc++-v3/include/bits/fs_path.h +++ b/libstdc++-v3/include/bits/fs_path.h @@ -116,7 +116,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 template using _Path = typename std::enable_if<__and_<__not_, path>>, - __not_>, + __not_>>, __constructible_from<_Tp1, _Tp2>>::value, path>::type; diff --git a/libstdc++-v3/include/experimental/bits/fs_path.h b/libstdc++-v3/include/experimental/bits/fs_path.h index ebd5072fc1ab..c649d10c035e 100644 --- a/libstdc++-v3/include/experimental/bits/fs_path.h +++ b/libstdc++-v3/include/experimental/bits/fs_path.h @@ -128,11 +128,12 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 : decltype(__is_path_src(std::declval<_Source>(), 0)) { }; - template + template::type, + typename _Tp1_noptr = typename remove_pointer<_Tp1>::type> using _Path = typename - std::enable_if<__and_<__not_::type, - path>>, - __not_>, + std::enable_if<__and_<__not_>, + __not_>, __constructible_from<_Tp1, _Tp2>>::value, path>::type; diff --git a/libstdc++-v3/testsuite/27_io/filesystem/path/construct/80762.cc b/libstdc++-v3/testsuite/27_io/filesystem/path/construct/80762.cc index 71cdaa9d9692..e22e3deb56e4 100644 --- a/libstdc++-v3/testsuite/27_io/filesystem/path/construct/80762.cc +++ b/libstdc++-v3/testsuite/27_io/filesystem/path/construct/80762.cc @@ -22,8 +22,18 @@ using std::filesystem::path; +// PR libstdc++/80762.cc static_assert( !std::is_constructible_v ); static_assert( !std::is_constructible_v ); static_assert( !std::is_constructible_v ); static_assert( !std::is_constructible_v ); static_assert( !std::is_constructible_v ); + +// PR libstdc++/90454.cc +static_assert( !std::is_constructible_v ); +static_assert( !std::is_constructible_v ); +static_assert( !std::is_constructible_v ); +static_assert( !std::is_constructible_v ); +static_assert( !std::is_constructible_v ); +static_assert( !std::is_constructible_v ); +static_assert( !std::is_constructible_v ); diff --git a/libstdc++-v3/testsuite/experimental/filesystem/path/construct/80762.cc b/libstdc++-v3/testsuite/experimental/filesystem/path/construct/80762.cc index fa4a64feb3ef..98dadabcffba 100644 --- a/libstdc++-v3/testsuite/experimental/filesystem/path/construct/80762.cc +++ b/libstdc++-v3/testsuite/experimental/filesystem/path/construct/80762.cc @@ -22,8 +22,18 @@ using std::experimental::filesystem::path; +// PR libstdc++/80762.cc static_assert( !std::is_constructible::value, "" ); static_assert( !std::is_constructible::value, "" ); static_assert( !std::is_constructible::value, "" ); static_assert( !std::is_constructible::value, "" ); static_assert( !std::is_constructible::value, "" ); + +// PR libstdc++/90454.cc +static_assert( !std::is_constructible::value, "" ); +static_assert( !std::is_constructible::value, "" ); +static_assert( !std::is_constructible::value, "" ); +static_assert( !std::is_constructible::value, "" ); +static_assert( !std::is_constructible::value, "" ); +static_assert( !std::is_constructible::value, "" ); +static_assert( !std::is_constructible::value, "" );