[Bug libstdc++/93884] New: ranges::copy doesn't like output iterators
cjdb.ns at gmail dot com
gcc-bugzilla@gcc.gnu.org
Sat Feb 22 17:57:00 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93884
Bug ID: 93884
Summary: ranges::copy doesn't like output iterators
Product: gcc
Version: 10.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: cjdb.ns at gmail dot com
Target Milestone: ---
ranges::copy doesn't currently like non-readable iterators as its second/third
argument.
* Branch: GCC trunk
* Version: gcc (GCC) 10.0.1 20200222 (experimental)
* Git Hash: d6f420d98126ac51396b89fbe287a32287cd92ed
* GCC configured with: ../gcc/configure --disable-nls --disable-multilib
--enable-languages=c,c++ --disable-werror
* GCC built with: CFLAGS='-O3 -g0 -w' CXXFLAGS='-O3 -g0 -w'
LDFLAGS='-fuse-ld=gold'
* System: Ubuntu 18.04 (WSL)
* GCC invocation: g++ -std=c++2a
Output:
```
copy.cpp: In function 'int main()':
copy.cpp:14:73: error: no match for call to '(const std::ranges::__copy_fn)
(std::ranges::iota_view<int, int>::_Iterator, std::ranges::iota_view<int,
int>::_Iterator, std::back_insert_iterator<std::vector<int> >)'
14 | ranges::copy(ranges::begin(i), ranges::end(i),
std::back_inserter(v));
|
^
In file included from /usr/local/include/c++/10.0.1/bits/ranges_algo.h:35,
from /usr/local/include/c++/10.0.1/algorithm:64,
from copy.cpp:1:
/usr/local/include/c++/10.0.1/bits/ranges_algobase.h:304:7: note: candidate:
'constexpr std::ranges::copy_result<_Iter, _Out>
std::ranges::__copy_fn::operator()(_Iter, _Sent, _Out) const [with _Iter =
std::ranges::iota_view<int, int>::_Iterator; _Sent =
std::ranges::iota_view<int, int>::_Iterator; _Out =
std::back_insert_iterator<std::vector<int> >; std::ranges::copy_result<_Iter,
_Out> = std::ranges::in_out_result<std::ranges::iota_view<int, int>::_Iterator,
std::back_insert_iterator<std::vector<int> > >]'
304 | operator()(_Iter __first, _Sent __last, _Out __result) const
| ^~~~~~~~
/usr/local/include/c++/10.0.1/bits/ranges_algobase.h:304:7: note: constraints
not satisfied
In file included from /usr/local/include/c++/10.0.1/compare:39,
from /usr/local/include/c++/10.0.1/bits/stl_pair.h:65,
from /usr/local/include/c++/10.0.1/utility:70,
from /usr/local/include/c++/10.0.1/algorithm:60,
from copy.cpp:1:
/usr/local/include/c++/10.0.1/concepts: In instantiation of 'constexpr
std::ranges::copy_result<_Iter, _Out> std::ranges::__copy_fn::operator()(_Iter,
_Sent, _Out) const [with _Iter = std::ranges::iota_view<int, int>::_Iterator;
_Sent = std::ranges::iota_view<int, int>::_Iterator; _Out =
std::back_insert_iterator<std::vector<int> >; std::ranges::copy_result<_Iter,
_Out> = std::ranges::in_out_result<std::ranges::iota_view<int, int>::_Iterator,
std::back_insert_iterator<std::vector<int> > >]':
copy.cpp:14:73: required from here
/usr/local/include/c++/10.0.1/concepts:138:13: required for the satisfaction
of 'constructible_from<std::back_insert_iterator<std::vector<int,
std::allocator<int> > > >'
/usr/local/include/c++/10.0.1/concepts:143:13: required for the satisfaction
of 'default_initializable<std::back_insert_iterator<std::vector<int,
std::allocator<int> > > >'
/usr/local/include/c++/10.0.1/bits/iterator_concepts.h:507:13: required for
the satisfaction of
'weakly_incrementable<std::back_insert_iterator<std::vector<int,
std::allocator<int> > > >'
/usr/local/include/c++/10.0.1/concepts:139:30: note: the expression
'is_constructible_v<_Tp, _Args ...>' evaluated to 'false'
139 | = destructible<_Tp> && is_constructible_v<_Tp, _Args...>;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/local/include/c++/10.0.1/bits/ranges_algo.h:35,
from /usr/local/include/c++/10.0.1/algorithm:64,
from copy.cpp:1:
/usr/local/include/c++/10.0.1/bits/ranges_algobase.h:314:7: note: candidate:
'template<class _Range, class _Out> requires (input_range<_Range>) &&
(weakly_incrementable<_Out>) &&
(indirectly_copyable<decltype(std::ranges::__cust::begin((declval<_Range&>)())),
_Out>) constexpr
std::ranges::copy_result<std::ranges::borrowed_iterator_t<_Range>, _Out>
std::ranges::__copy_fn::operator()(_Range&&, _Out) const'
314 | operator()(_Range&& __r, _Out __result) const
| ^~~~~~~~
/usr/local/include/c++/10.0.1/bits/ranges_algobase.h:314:7: note: template
argument deduction/substitution failed:
copy.cpp:14:73: note: candidate expects 2 arguments, 3 provided
14 | ranges::copy(ranges::begin(i), ranges::end(i),
std::back_inserter(v));
|
^
copy.cpp:15:84: error: no match for call to '(const std::ranges::__copy_fn)
(std::ranges::iota_view<int, int>::_Iterator, std::ranges::iota_view<int,
int>::_Iterator, std::insert_iterator<std::vector<int> >)'
15 | ranges::copy(ranges::begin(i), ranges::end(i), std::inserter(v,
ranges::end(v)));
|
^
In file included from /usr/local/include/c++/10.0.1/bits/ranges_algo.h:35,
from /usr/local/include/c++/10.0.1/algorithm:64,
from copy.cpp:1:
/usr/local/include/c++/10.0.1/bits/ranges_algobase.h:304:7: note: candidate:
'constexpr std::ranges::copy_result<_Iter, _Out>
std::ranges::__copy_fn::operator()(_Iter, _Sent, _Out) const [with _Iter =
std::ranges::iota_view<int, int>::_Iterator; _Sent =
std::ranges::iota_view<int, int>::_Iterator; _Out =
std::insert_iterator<std::vector<int> >; std::ranges::copy_result<_Iter, _Out>
= std::ranges::in_out_result<std::ranges::iota_view<int, int>::_Iterator,
std::insert_iterator<std::vector<int> > >]'
304 | operator()(_Iter __first, _Sent __last, _Out __result) const
| ^~~~~~~~
/usr/local/include/c++/10.0.1/bits/ranges_algobase.h:304:7: note: constraints
not satisfied
In file included from /usr/local/include/c++/10.0.1/compare:39,
from /usr/local/include/c++/10.0.1/bits/stl_pair.h:65,
from /usr/local/include/c++/10.0.1/utility:70,
from /usr/local/include/c++/10.0.1/algorithm:60,
from copy.cpp:1:
/usr/local/include/c++/10.0.1/concepts: In instantiation of 'constexpr
std::ranges::copy_result<_Iter, _Out> std::ranges::__copy_fn::operator()(_Iter,
_Sent, _Out) const [with _Iter = std::ranges::iota_view<int, int>::_Iterator;
_Sent = std::ranges::iota_view<int, int>::_Iterator; _Out =
std::insert_iterator<std::vector<int> >; std::ranges::copy_result<_Iter, _Out>
= std::ranges::in_out_result<std::ranges::iota_view<int, int>::_Iterator,
std::insert_iterator<std::vector<int> > >]':
copy.cpp:15:84: required from here
/usr/local/include/c++/10.0.1/concepts:138:13: required for the satisfaction
of 'constructible_from<std::insert_iterator<std::vector<int,
std::allocator<int> > > >'
/usr/local/include/c++/10.0.1/concepts:143:13: required for the satisfaction
of 'default_initializable<std::insert_iterator<std::vector<int,
std::allocator<int> > > >'
/usr/local/include/c++/10.0.1/bits/iterator_concepts.h:507:13: required for
the satisfaction of 'weakly_incrementable<std::insert_iterator<std::vector<int,
std::allocator<int> > > >'
/usr/local/include/c++/10.0.1/concepts:139:30: note: the expression
'is_constructible_v<_Tp, _Args ...>' evaluated to 'false'
139 | = destructible<_Tp> && is_constructible_v<_Tp, _Args...>;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/local/include/c++/10.0.1/bits/ranges_algo.h:35,
from /usr/local/include/c++/10.0.1/algorithm:64,
from copy.cpp:1:
/usr/local/include/c++/10.0.1/bits/ranges_algobase.h:314:7: note: candidate:
'template<class _Range, class _Out> requires (input_range<_Range>) &&
(weakly_incrementable<_Out>) &&
(indirectly_copyable<decltype(std::ranges::__cust::begin((declval<_Range&>)())),
_Out>) constexpr
std::ranges::copy_result<std::ranges::borrowed_iterator_t<_Range>, _Out>
std::ranges::__copy_fn::operator()(_Range&&, _Out) const'
314 | operator()(_Range&& __r, _Out __result) const
| ^~~~~~~~
/usr/local/include/c++/10.0.1/bits/ranges_algobase.h:314:7: note: template
argument deduction/substitution failed:
copy.cpp:15:84: note: candidate expects 2 arguments, 3 provided
15 | ranges::copy(ranges::begin(i), ranges::end(i), std::inserter(v,
ranges::end(v)));
|
^
copy.cpp:18:74: error: no match for call to '(const std::ranges::__copy_fn)
(std::ranges::iota_view<int, int>::_Iterator, std::ranges::iota_view<int,
int>::_Iterator, std::front_insert_iterator<std::deque<int> >)'
18 | ranges::copy(ranges::begin(i), ranges::end(i),
std::front_inserter(d));
|
^
In file included from /usr/local/include/c++/10.0.1/bits/ranges_algo.h:35,
from /usr/local/include/c++/10.0.1/algorithm:64,
from copy.cpp:1:
/usr/local/include/c++/10.0.1/bits/ranges_algobase.h:304:7: note: candidate:
'constexpr std::ranges::copy_result<_Iter, _Out>
std::ranges::__copy_fn::operator()(_Iter, _Sent, _Out) const [with _Iter =
std::ranges::iota_view<int, int>::_Iterator; _Sent =
std::ranges::iota_view<int, int>::_Iterator; _Out =
std::front_insert_iterator<std::deque<int> >; std::ranges::copy_result<_Iter,
_Out> = std::ranges::in_out_result<std::ranges::iota_view<int, int>::_Iterator,
std::front_insert_iterator<std::deque<int> > >]'
304 | operator()(_Iter __first, _Sent __last, _Out __result) const
| ^~~~~~~~
/usr/local/include/c++/10.0.1/bits/ranges_algobase.h:304:7: note: constraints
not satisfied
In file included from /usr/local/include/c++/10.0.1/compare:39,
from /usr/local/include/c++/10.0.1/bits/stl_pair.h:65,
from /usr/local/include/c++/10.0.1/utility:70,
from /usr/local/include/c++/10.0.1/algorithm:60,
from copy.cpp:1:
/usr/local/include/c++/10.0.1/concepts: In instantiation of 'constexpr
std::ranges::copy_result<_Iter, _Out> std::ranges::__copy_fn::operator()(_Iter,
_Sent, _Out) const [with _Iter = std::ranges::iota_view<int, int>::_Iterator;
_Sent = std::ranges::iota_view<int, int>::_Iterator; _Out =
std::front_insert_iterator<std::deque<int> >; std::ranges::copy_result<_Iter,
_Out> = std::ranges::in_out_result<std::ranges::iota_view<int, int>::_Iterator,
std::front_insert_iterator<std::deque<int> > >]':
copy.cpp:18:74: required from here
/usr/local/include/c++/10.0.1/concepts:138:13: required for the satisfaction
of 'constructible_from<std::front_insert_iterator<std::deque<int,
std::allocator<int> > > >'
/usr/local/include/c++/10.0.1/concepts:143:13: required for the satisfaction
of 'default_initializable<std::front_insert_iterator<std::deque<int,
std::allocator<int> > > >'
/usr/local/include/c++/10.0.1/bits/iterator_concepts.h:507:13: required for
the satisfaction of
'weakly_incrementable<std::front_insert_iterator<std::deque<int,
std::allocator<int> > > >'
/usr/local/include/c++/10.0.1/concepts:139:30: note: the expression
'is_constructible_v<_Tp, _Args ...>' evaluated to 'false'
139 | = destructible<_Tp> && is_constructible_v<_Tp, _Args...>;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/local/include/c++/10.0.1/bits/ranges_algo.h:35,
from /usr/local/include/c++/10.0.1/algorithm:64,
from copy.cpp:1:
/usr/local/include/c++/10.0.1/bits/ranges_algobase.h:314:7: note: candidate:
'template<class _Range, class _Out> requires (input_range<_Range>) &&
(weakly_incrementable<_Out>) &&
(indirectly_copyable<decltype(std::ranges::__cust::begin((declval<_Range&>)())),
_Out>) constexpr
std::ranges::copy_result<std::ranges::borrowed_iterator_t<_Range>, _Out>
std::ranges::__copy_fn::operator()(_Range&&, _Out) const'
314 | operator()(_Range&& __r, _Out __result) const
| ^~~~~~~~
/usr/local/include/c++/10.0.1/bits/ranges_algobase.h:314:7: note: template
argument deduction/substitution failed:
copy.cpp:18:74: note: candidate expects 2 arguments, 3 provided
18 | ranges::copy(ranges::begin(i), ranges::end(i),
std::front_inserter(d));
|
^
```
More information about the Gcc-bugs
mailing list