You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
auto odd_ints = ranges::view::ints(1)|ranges::view::remove_if([](auto&& x){return x%2==0;});
It compiles on gcc 4.9.1 (from macports "gcc49 @4.9.1_1"). Clang pre 3.6 (from macports clang-3.6 @3.6-r222672_0+analyzer+arm_runtime+assertions) does however fail with the error:
src/main.cpp:114:86: error: invalid operands to binary expression ('ranges::v3::iota_view<int, void>' and 'int')
auto odd_ints = ranges::view::ints(1)|ranges::view::remove_if([](auto&& x){return x%2==0;});
~^~
Thus, x seems to be of type ranges::v3::iota_view<int, void> and not int (or const int&).
Changing the argument of the filter predicate to intmakes it compile:
auto odd_ints = ranges::view::ints(1)|ranges::view::remove_if([](int x){return x%2==0;});
While interestingly, trying to explicitly convert x to int does not:
src/main.cpp:114:86: error: no matching conversion for C-style cast from 'ranges::v3::iota_view<int, void>' to 'int'
auto odd_ints = ranges::view::ints(1)|ranges::view::remove_if([](auto&& x){return ((int)x)%2==0;});
^~~~~~
Is this a clang-bug which should be reported(?), or is it a ranges-bug which exploits non-standard behavior of gcc?
The text was updated successfully, but these errors were encountered:
Consider the following code:
It compiles on gcc 4.9.1 (from macports "gcc49 @4.9.1_1"). Clang pre 3.6 (from macports clang-3.6 @3.6-r222672_0+analyzer+arm_runtime+assertions) does however fail with the error:
Thus, x seems to be of type
ranges::v3::iota_view<int, void>
and notint
(orconst int&
).Changing the argument of the filter predicate to
int
makes it compile:While interestingly, trying to explicitly convert x to int does not:
Is this a clang-bug which should be reported(?), or is it a ranges-bug which exploits non-standard behavior of gcc?
The text was updated successfully, but these errors were encountered: