diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2019-05-13 21:12:06 +0100 |
---|---|---|
committer | Jonathan Wakely <redi@gcc.gnu.org> | 2019-05-13 21:12:06 +0100 |
commit | bceb07e3584c9d8ea3e5760636ae24ff7f8606ff (patch) | |
tree | 548aa85b283f5123201fab5a3f4c86265bd3d498 | |
parent | 0dd50fc6f13c02d9d548fd57e7f8f7020241e317 (diff) | |
download | gcc-bceb07e3584c9d8ea3e5760636ae24ff7f8606ff.zip gcc-bceb07e3584c9d8ea3e5760636ae24ff7f8606ff.tar.gz gcc-bceb07e3584c9d8ea3e5760636ae24ff7f8606ff.tar.bz2 |
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<void*>::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
-rw-r--r-- | libstdc++-v3/ChangeLog | 8 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/fs_path.h | 2 | ||||
-rw-r--r-- | libstdc++-v3/include/experimental/bits/fs_path.h | 9 | ||||
-rw-r--r-- | libstdc++-v3/testsuite/27_io/filesystem/path/construct/80762.cc | 10 | ||||
-rw-r--r-- | libstdc++-v3/testsuite/experimental/filesystem/path/construct/80762.cc | 10 |
5 files changed, 34 insertions, 5 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index afd1b3c..c25f2ac 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,13 @@ 2019-05-13 Jonathan Wakely <jwakely@redhat.com> + 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 <remark> 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 d1ad11a..cec3561 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<typename _Tp1, typename _Tp2 = void> using _Path = typename std::enable_if<__and_<__not_<is_same<remove_cv_t<_Tp1>, path>>, - __not_<is_void<_Tp1>>, + __not_<is_void<remove_pointer_t<_Tp1>>>, __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 f81f33c..588f068 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<typename _Tp1, typename _Tp2 = void> + template<typename _Tp1, typename _Tp2 = void, + typename _Tp1_nocv = typename remove_cv<_Tp1>::type, + typename _Tp1_noptr = typename remove_pointer<_Tp1>::type> using _Path = typename - std::enable_if<__and_<__not_<is_same<typename remove_cv<_Tp1>::type, - path>>, - __not_<is_void<_Tp1>>, + std::enable_if<__and_<__not_<is_same<_Tp1_nocv, path>>, + __not_<is_void<_Tp1_noptr>>, __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 71cdaa9..e22e3de 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<path, void> ); static_assert( !std::is_constructible_v<path, volatile path> ); static_assert( !std::is_constructible_v<path, volatile path&> ); static_assert( !std::is_constructible_v<path, const volatile path> ); static_assert( !std::is_constructible_v<path, const volatile path&> ); + +// PR libstdc++/90454.cc +static_assert( !std::is_constructible_v<path, void*> ); +static_assert( !std::is_constructible_v<path, const void*> ); +static_assert( !std::is_constructible_v<path, volatile void*> ); +static_assert( !std::is_constructible_v<path, const volatile void*> ); +static_assert( !std::is_constructible_v<path, void*&> ); +static_assert( !std::is_constructible_v<path, void* const&> ); +static_assert( !std::is_constructible_v<path, const void* const&> ); diff --git a/libstdc++-v3/testsuite/experimental/filesystem/path/construct/80762.cc b/libstdc++-v3/testsuite/experimental/filesystem/path/construct/80762.cc index fa4a64f..98dadab 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<path, void>::value, "" ); static_assert( !std::is_constructible<path, volatile path>::value, "" ); static_assert( !std::is_constructible<path, volatile path&>::value, "" ); static_assert( !std::is_constructible<path, const volatile path>::value, "" ); static_assert( !std::is_constructible<path, const volatile path&>::value, "" ); + +// PR libstdc++/90454.cc +static_assert( !std::is_constructible<path, void*>::value, "" ); +static_assert( !std::is_constructible<path, const void*>::value, "" ); +static_assert( !std::is_constructible<path, volatile void*>::value, "" ); +static_assert( !std::is_constructible<path, const volatile void*>::value, "" ); +static_assert( !std::is_constructible<path, void*&>::value, "" ); +static_assert( !std::is_constructible<path, void* const&>::value, "" ); +static_assert( !std::is_constructible<path, const void* const&>::value, "" ); |