From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 731CA3858C83; Thu, 1 Sep 2022 20:45:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 731CA3858C83 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1662065113; bh=YbwN/z+92K7KkJ20rbbTn0A9ur7HSDCzWNmR+MHlqoo=; h=From:To:Subject:Date:From; b=nQC5nmaFYZx1jycUiEsY+kbn8xLBzWNLCH5/6KL7ByN/hkm8LnvNIhDZx4HRLPnko iliwpoHBQcceeOT1LmnzrzaMj0o9xjKcVEQo2GBruOFOSI2U+XBw8y/bRBIirU3kQ8 hYsQVkhsB1JcCXKJoeU+iFgnqlh0Dip6FBQCieK4= From: "andysem at mail dot ru" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/106808] New: std::string_view range concept requirement causes compile error with Boost.Filesystem Date: Thu, 01 Sep 2022 20:45:12 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 11.2.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: andysem at mail dot ru X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D106808 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=3D53528&action=3Dedit Preprocessed code of the reproducer. The following code fails to compile in C++23 mode: #include int main() { boost::filesystem::path p =3D "foo"; boost::filesystem::path p2 =3D p; } $ g++ -std=3Dc++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 =E2=80=98templat= e requires (__maybe_borrowed_range<_Tp>) && ((is_array_v::type>) || (__member_begin<_Tp>) || (__adl_begin<_Tp>)) constexpr auto std::ranges::__cust_access::_Begin::operator()(_Tp&&) const [with _Tp =3D c= onst boost::filesystem::path&]=E2=80=99: /usr/include/c++/11/bits/ranges_base.h:576:15: required by substitution of =E2=80=98template requires !(is_same_v<_DRang= e, std::basic_string_view>) && (contiguous_range<_Range>) && (sized_range<_Ran= ge>) && (is_same_v)()))>::type, std::indirectly_readable_traits)()))>::type> >::__iter_traits)()))>::type, std::indirectly_readable_traits)()))>::type> >::value_type, _CharT>) && !(is_convertible_v<_Range, const _CharT*>) && !requires(_DRange& __d) {__d->__conv_op ();} && (!requires{typename _DRange::traits_type;} || (is_same_v)) constexpr std::basic_string_view::basic_string_view(_Range&&) [with _Range =3D wchar_t; _DRange =3D std::char_traits]=E2=80=99 ./boost/filesystem/detail/path_traits.hpp:514:93: required from =E2=80=98= constexpr const bool boost::filesystem::detail::path_traits::is_convertible_to_std_string_view::value=E2=80=99 ./boost/type_traits/disjunction.hpp:31:27: required from =E2=80=98struct boost::disjunction, boost::filesystem::detail::path_traits::is_convertible_to_path_source_non_s= td_string_view >=E2=80=99 ./boost/filesystem/detail/path_traits.hpp:537:8: required from =E2=80=98s= truct boost::filesystem::detail::path_traits::is_convertible_to_path_source=E2=80=99 ./boost/type_traits/disjunction.hpp:26:8: required from =E2=80=98struct boost::disjunction >=E2=80=99 ./boost/type_traits/disjunction.hpp:30:8: required from =E2=80=98struct boost::disjunction, boost::filesystem::detail::path_traits::is_convertible_to_path_source >=E2=80=99 ./boost/type_traits/conjunction.hpp:31:27: required from =E2=80=98struct boost::conjunction, boost::filesystem::detail::path_traits::is_convertible_to_path_source >, boost::negation > >=E2=80=99 ./boost/filesystem/path.hpp:249:9: required by substitution of =E2=80=98template boost::filesystem::path::path(const = Source&) [with Source =3D boost::filesystem::path; =3D ]=E2=80=99 fs_concepts_issue.cpp:6:34: required from here /usr/include/c++/11/bits/iterator_concepts.h:942:15: required for the satisfaction of =E2=80=98__member_begin<_Tp>=E2=80=99 [with _Tp =3D const boost::filesystem::path&] /usr/include/c++/11/bits/iterator_concepts.h:942:32: in requirements with =E2=80=98_Tp& __t=E2=80=99 [with _Tp =3D const boost::filesystem::path&] /usr/include/c++/11/bits/iterator_concepts.h:942:32: error: satisfaction va= lue of atomic constraint =E2=80=98requires(_Tp& __t) {{std::ranges::__cust_access::__decay_copy(__t->begin())} -> decltype(auto) [requires std::input_or_output_iterator<, >];} [with _Tp =3D c= onst boost::filesystem::path&]=E2=80=99 changed from =E2=80=98false=E2=80=99 to = =E2=80=98true=E2=80=99 942 | concept __member_begin =3D requires(_Tp& __t) | ^~~~~~~~~~~~~~~~~~ 943 | { | ~=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20 944 | { __decay_copy(__t.begin()) } -> input_or_output_iterator; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 945 | }; | ~=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20 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 fir= st evaluated to =E2=80=98false=E2=80=99 from here 576 | ranges::begin(__t); | ~~~~~~~~~~~~~^~~~~ $ g++ -v Using built-in specs. COLLECT_GCC=3Dg++ COLLECT_LTO_WRAPPER=3D/usr/lib/gcc/x86_64-linux-gnu/11/lto-wrapper OFFLOAD_TARGET_NAMES=3Dnvptx-none:amdgcn-amdhsa OFFLOAD_TARGET_DEFAULT=3D1 Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion=3D'Ubuntu 11.2.0-19ubuntu1' --with-bugurl=3Dfile:///usr/share/doc/gcc-11/README.Bugs --enable-languages=3Dc,ada,c++,go,brig,d,fortran,objc,obj-c++,m2 --prefix= =3D/usr --with-gcc-major-version-only --program-suffix=3D-11 --program-prefix=3Dx86_64-linux-gnu- --enable-shared --enable-linker-build-= id --libexecdir=3D/usr/lib --without-included-gettext --enable-threads=3Dposix --libdir=3D/usr/lib --enable-nls --enable-bootstrap --enable-clocale=3Dgnu --enable-libstdcxx-debug --enable-libstdcxx-time=3Dyes --with-default-libstdcxx-abi=3Dnew --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-= zlib --enable-libphobos-checking=3Drelease --with-target-system-zlib=3Dauto --enable-objc-gc=3Dauto --enable-multiarch --disable-werror --enable-cet --with-arch-32=3Di686 --with-abi=3Dm64 --with-multilib-list=3Dm32,m64,mx32 --enable-multilib --with-tune=3Dgeneric --enable-offload-targets=3Dnvptx-none=3D/build/gcc-11-gBFGDP/gcc-11-11.2.0/= debian/tmp-nvptx/usr,amdgcn-amdhsa=3D/build/gcc-11-gBFGDP/gcc-11-11.2.0/deb= ian/tmp-gcn/usr --without-cuda-driver --enable-checking=3Drelease --build=3Dx86_64-linux-gnu --host=3Dx86_64-linux-gnu --target=3Dx86_64-linux-gnu --with-build-config=3Dbootstrap-lto-lean --enable-link-serialization=3D2 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=3Dc++20. It also compiles with MSVC 14.3 /std:c++latest Sorry, I have little knowledge about concepts and I couldn't reduce the rep= ro further. I've attached the preprocessed code.=