[cfe-users] Compiling C++ 20 Example from 24.6.4.1 [range.istream.overview] produces errors with libstdc++ 10
Ray Lischner via cfe-users
cfe-users at lists.llvm.org
Wed May 6 09:24:04 PDT 2020
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?
--
Ray Lischner
More information about the cfe-users
mailing list