[cfe-users] Compiling C++ 20 Example from 24.6.4.1 [range.istream.overview] produces errors with libstdc++ 10

Richard Smith via cfe-users cfe-users at lists.llvm.org
Wed May 13 19:09:37 PDT 2020


On Wed, 6 May 2020 at 09:24, Ray Lischner via cfe-users <
cfe-users at lists.llvm.org> wrote:

> I am using clang++ 10 with GCC libstdc++ 10 prerelease. I tried
> compiling the example from section 24.6.4.1 [range.istream.overview]. It
> works with g++ 10 but with clang++ 10 -std=c++20, I get
> constraint-failure errors.
>
> program:
> #include <algorithm>
> #include <iostream>
> #include <iterator>
> #include <ranges>
> #include <sstream>
>
> int main()
> {
>    using namespace std;
>    using namespace ranges;
>    auto ints = istringstream{"0 1  2   3     4"};
>    ranges::copy(istream_view<int>(ints), ostream_iterator<int>{cout, "-"});
>    // prints0-1-2-3-4-
> }
>
> $ clang++ -std=c++20 -o range_istream_overview \
> range_istream_overview.cpp
>
> Gist of the errors is that the istream_view fails the constraints for a
> range because ranges::begin() fails its constraint for the
> basic_istream_view::begin() member function:
>
> { __detail::__decay_copy(__t.begin()) } -> input_or_output_iterator;
>
> Any ideas what's wrong or how to proceed?
>

Please could you provide the complete set of diagnostics from the
compilation?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-users/attachments/20200513/408e909b/attachment.html>


More information about the cfe-users mailing list