https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93983
Bug ID: 93983 Summary: std::filesystem::path is not concept-friendly Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: lyberta at lyberta dot net Target Milestone: --- #include <concepts> #include <filesystem> struct Foo { Foo(const std::filesystem::path& p); }; static_assert(std::copyable<Foo>); Error: In file included from <source>:1: /opt/compiler-explorer/gcc-trunk-20200229/include/c++/10.0.1/bits/stl_iterator_base_types.h: In instantiation of 'struct std::iterator_traits<Foo>': /opt/compiler-explorer/gcc-trunk-20200229/include/c++/10.0.1/bits/fs_path.h:84:11: required by substitution of 'template<class _Iter, class _Iter_traits> using __is_path_iter_src = std::__and_<std::__or_<std::is_same<typename std::remove_const<typename _Iter_traits::value_type>::type, char>, std::is_same<typename std::remove_const<typename _Iter_traits::value_type>::type, char8_t>, std::is_same<typename std::remove_const<typename _Iter_traits::value_type>::type, wchar_t>, std::is_same<typename std::remove_const<typename _Iter_traits::value_type>::type, char16_t>, std::is_same<typename std::remove_const<typename _Iter_traits::value_type>::type, char32_t> >, std::is_base_of<std::input_iterator_tag, typename _Iter_traits::iterator_category> > [with _Iter = Foo; _Iter_traits = std::iterator_traits<Foo>]' /opt/compiler-explorer/gcc-trunk-20200229/include/c++/10.0.1/bits/fs_path.h:91:5: required by substitution of 'template<class _Iter> std::filesystem::__cxx11::__detail::__is_path_iter_src<_Iter> std::filesystem::__cxx11::__detail::__is_path_src(_Iter, int) [with _Iter = Foo]' /opt/compiler-explorer/gcc-trunk-20200229/include/c++/10.0.1/bits/fs_path.h:115:29: required from 'struct std::filesystem::__cxx11::__detail::__constructible_from<Foo, void>' /opt/compiler-explorer/gcc-trunk-20200229/include/c++/10.0.1/type_traits:138:12: required from 'struct std::__and_<std::__not_<std::is_void<Foo> >, std::filesystem::__cxx11::__detail::__constructible_from<Foo, void> >' /opt/compiler-explorer/gcc-trunk-20200229/include/c++/10.0.1/type_traits:143:12: required from 'struct std::__and_<std::__not_<std::is_same<Foo, std::filesystem::__cxx11::path> >, std::__not_<std::is_void<Foo> >, std::filesystem::__cxx11::__detail::__constructible_from<Foo, void> >' /opt/compiler-explorer/gcc-trunk-20200229/include/c++/10.0.1/bits/fs_path.h:119:11: required by substitution of 'template<class _Tp1, class _Tp2> using _Path = typename std::enable_if<std::__and_<std::__not_<std::is_same<typename std::remove_cv< <template-parameter-1-1> >::type, std::filesystem::__cxx11::path> >, std::__not_<std::is_void<typename std::remove_pointer<_Tp>::type> >, std::filesystem::__cxx11::__detail::__constructible_from<_Tp1, _Tp2> >::value, std::filesystem::__cxx11::path>::type [with _Tp1 = Foo; _Tp2 = void]' /opt/compiler-explorer/gcc-trunk-20200229/include/c++/10.0.1/bits/fs_path.h:219:7: required by substitution of 'template<class _Source, class _Require> std::filesystem::__cxx11::path::path(const _Source&, std::filesystem::__cxx11::path::format) [with _Source = Foo; _Require = <missing>]' /opt/compiler-explorer/gcc-trunk-20200229/include/c++/10.0.1/type_traits:901:30: required from 'struct std::__is_constructible_impl<Foo, Foo>' /opt/compiler-explorer/gcc-trunk-20200229/include/c++/10.0.1/type_traits:906:12: required from 'struct std::is_constructible<Foo, Foo>' /opt/compiler-explorer/gcc-trunk-20200229/include/c++/10.0.1/type_traits:3107:25: required from 'constexpr const bool std::is_constructible_v<Foo, Foo>' /opt/compiler-explorer/gcc-trunk-20200229/include/c++/10.0.1/concepts:139:30: required from here /opt/compiler-explorer/gcc-trunk-20200229/include/c++/10.0.1/concepts:139:30: error: the value of 'std::is_constructible_v<Foo, Foo>' is not usable in a constant expression 139 | = destructible<_Tp> && is_constructible_v<_Tp, _Args...>; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /opt/compiler-explorer/gcc-trunk-20200229/include/c++/10.0.1/concepts:44, from <source>:1: /opt/compiler-explorer/gcc-trunk-20200229/include/c++/10.0.1/type_traits:3107:25: note: 'std::is_constructible_v<Foo, Foo>' used in its own initializer 3107 | inline constexpr bool is_constructible_v = | ^~~~~~~~~~~~~~~~~~