https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106808
Bug ID: 106808 Summary: std::string_view range concept requirement causes compile error with Boost.Filesystem Product: gcc Version: 11.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: andysem at mail dot ru Target Milestone: --- Created attachment 53528 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53528&action=edit Preprocessed code of the reproducer. The following code fails to compile in C++23 mode: #include <boost/filesystem/path.hpp> int main() { boost::filesystem::path p = "foo"; boost::filesystem::path p2 = p; } $ g++ -std=c++23 -I. -c fs_concepts_issue.cpp -o fs_concepts_issue.o In file included from /usr/include/c++/11/bits/stl_iterator_base_types.h:71, from /usr/include/c++/11/bits/stl_algobase.h:65, from /usr/include/c++/11/bits/char_traits.h:39, from /usr/include/c++/11/string:40, from /usr/include/c++/11/bits/locale_classes.h:40, from /usr/include/c++/11/locale:39, from ./boost/filesystem/detail/path_traits.hpp:18, from ./boost/filesystem/path.hpp:21, from fs_concepts_issue.cpp:1: /usr/include/c++/11/bits/ranges_base.h: In substitution of ‘template<class _Tp> requires (__maybe_borrowed_range<_Tp>) && ((is_array_v<typename std::remove_reference<_Tp>::type>) || (__member_begin<_Tp>) || (__adl_begin<_Tp>)) constexpr auto std::ranges::__cust_access::_Begin::operator()(_Tp&&) const [with _Tp = const boost::filesystem::path&]’: /usr/include/c++/11/bits/ranges_base.h:576:15: required by substitution of ‘template<class _Range, class _DRange> requires !(is_same_v<_DRange, std::basic_string_view>) && (contiguous_range<_Range>) && (sized_range<_Range>) && (is_same_v<typename std::__detail::__iter_traits_impl<typename std::remove_cvref<decltype(std::ranges::__cust_access::__begin((declval<_Range&>)()))>::type, std::indirectly_readable_traits<typename std::remove_cvref<decltype(std::ranges::__cust_access::__begin((declval<_Range&>)()))>::type> >::__iter_traits<typename std::remove_cvref<decltype(std::ranges::__cust_access::__begin((declval<_Range&>)()))>::type, std::indirectly_readable_traits<typename std::remove_cvref<decltype(std::ranges::__cust_access::__begin((declval<_Range&>)()))>::type> >::value_type, _CharT>) && !(is_convertible_v<_Range, const _CharT*>) && !requires(_DRange& __d) {__d->__conv_op ();} && (!requires{typename _DRange::traits_type;} || (is_same_v<typename _DRange::traits_type, _Traits>)) constexpr std::basic_string_view<wchar_t>::basic_string_view(_Range&&) [with _Range = wchar_t; _DRange = std::char_traits<wchar_t>]’ ./boost/filesystem/detail/path_traits.hpp:514:93: required from ‘constexpr const bool boost::filesystem::detail::path_traits::is_convertible_to_std_string_view<boost::filesystem::path>::value’ ./boost/type_traits/disjunction.hpp:31:27: required from ‘struct boost::disjunction<boost::filesystem::detail::path_traits::is_convertible_to_std_string_view<boost::filesystem::path>, boost::filesystem::detail::path_traits::is_convertible_to_path_source_non_std_string_view<boost::filesystem::path> >’ ./boost/filesystem/detail/path_traits.hpp:537:8: required from ‘struct boost::filesystem::detail::path_traits::is_convertible_to_path_source<boost::filesystem::path>’ ./boost/type_traits/disjunction.hpp:26:8: required from ‘struct boost::disjunction<boost::filesystem::detail::path_traits::is_convertible_to_path_source<boost::filesystem::path> >’ ./boost/type_traits/disjunction.hpp:30:8: required from ‘struct boost::disjunction<boost::filesystem::detail::path_traits::is_path_source<boost::filesystem::path>, boost::filesystem::detail::path_traits::is_convertible_to_path_source<boost::filesystem::path> >’ ./boost/type_traits/conjunction.hpp:31:27: required from ‘struct boost::conjunction<boost::disjunction<boost::filesystem::detail::path_traits::is_path_source<boost::filesystem::path>, boost::filesystem::detail::path_traits::is_convertible_to_path_source<boost::filesystem::path> >, boost::negation<boost::filesystem::detail::path_traits::is_native_path_source<boost::filesystem::path> > >’ ./boost/filesystem/path.hpp:249:9: required by substitution of ‘template<class Source, class> boost::filesystem::path::path(const Source&) [with Source = boost::filesystem::path; <template-parameter-1-2> = <missing>]’ fs_concepts_issue.cpp:6:34: required from here /usr/include/c++/11/bits/iterator_concepts.h:942:15: required for the satisfaction of ‘__member_begin<_Tp>’ [with _Tp = const boost::filesystem::path&] /usr/include/c++/11/bits/iterator_concepts.h:942:32: in requirements with ‘_Tp& __t’ [with _Tp = const boost::filesystem::path&] /usr/include/c++/11/bits/iterator_concepts.h:942:32: error: satisfaction value of atomic constraint ‘requires(_Tp& __t) {{std::ranges::__cust_access::__decay_copy(__t->begin())} -> decltype(auto) [requires std::input_or_output_iterator<<placeholder>, >];} [with _Tp = const boost::filesystem::path&]’ changed from ‘false’ to ‘true’ 942 | concept __member_begin = requires(_Tp& __t) | ^~~~~~~~~~~~~~~~~~ 943 | { | ~ 944 | { __decay_copy(__t.begin()) } -> input_or_output_iterator; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 945 | }; | ~ In file included from /usr/include/c++/11/string_view:48, from /usr/include/c++/11/bits/basic_string.h:48, from /usr/include/c++/11/string:55, from /usr/include/c++/11/bits/locale_classes.h:40, from /usr/include/c++/11/locale:39, from ./boost/filesystem/detail/path_traits.hpp:18, from ./boost/filesystem/path.hpp:21, from fs_concepts_issue.cpp:1: /usr/include/c++/11/bits/ranges_base.h:576:22: note: satisfaction value first evaluated to ‘false’ from here 576 | ranges::begin(__t); | ~~~~~~~~~~~~~^~~~~ $ g++ -v Using built-in specs. COLLECT_GCC=g++ COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/11/lto-wrapper OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa OFFLOAD_TARGET_DEFAULT=1 Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu 11.2.0-19ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-11/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-11 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-11-gBFGDP/gcc-11-11.2.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-11-gBFGDP/gcc-11-11.2.0/debian/tmp-gcn/usr --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-serialization=2 Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 11.2.0 (Ubuntu 11.2.0-19ubuntu1) This is with Boost.Filesystem revision 5d4c1caaab65012f939ffa118cc1f36d34198c0b. The code compiles with -std=c++20. It also compiles with MSVC 14.3 /std:c++latest Sorry, I have little knowledge about concepts and I couldn't reduce the repro further. I've attached the preprocessed code.