From: Jonathan Wakely Date: Mon, 13 May 2019 20:12:06 +0000 (+0100) Subject: PR libstdc++/90454.cc path construction from void* X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=bceb07e3584c9d8ea3e5760636ae24ff7f8606ff;p=gcc.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. 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: r271134 --- diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index afd1b3c47f8..c25f2ac7641 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,13 @@ 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. + * doc/xml/manual/policy_data_structures.xml: Comment out stray elements. Fix formatting of bibliography references. diff --git a/libstdc++-v3/include/bits/fs_path.h b/libstdc++-v3/include/bits/fs_path.h index d1ad11a60c4..cec35614b42 100644 --- a/libstdc++-v3/include/bits/fs_path.h +++ b/libstdc++-v3/include/bits/fs_path.h @@ -115,7 +115,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 f81f33ca161..588f06822be 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 71cdaa9d969..e22e3deb56e 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 fa4a64feb3e..98dadabcffb 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, "" );