-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Closed
Copy link
Labels
bugSomething isn't workingSomething isn't workingfixedSomething works now, yay!Something works now, yay!rangesC++20/23 rangesC++20/23 ranges
Description
Command-line test case
#include <ranges>
using namespace std;
const auto rice = views::repeat("🌾"sv, 100zu); // difference_type is _Signed128
const auto taken_rice = rice | views::take(3);
static_assert(ranges::range<decltype(taken_rice)>); // error!PS D:\stl-playground> clang-cl /std:c++latest /Zs .\iota_diff.cpp
In file included from .\iota_diff.cpp:1:
In file included from D:\stl\Out\build\x64\out\inc\ranges:16:
In file included from D:\stl\Out\build\x64\out\inc\iterator:12:
In file included from D:\stl\Out\build\x64\out\inc\xutility:12:
D:\stl\Out\build\x64\out\inc\__msvc_iter_core.hpp(96,1): error: no type named 'difference_type' in 'std::incrementable_traits<std::_Signed128>'
using iter_difference_t = typename conditional_t<_Is_from_primary<iterator_traits<remove_cvref_t<_Ty>>>,
^~~~~
[...]The main reason of this error is that _Signed128 does not model weakly_incrementable.
Expected behavior
This code should compile.
Additional context
The truth is that standard does not require _Signed128 to model weakly_incrementable ([range.iota.view]/1), but it would be very nice if it did:
#include <ranges>
using namespace std;
using X = ranges::_Iota_diff_t<size_t>;
static_assert(!weakly_incrementable<X>);
using Y = ranges::_Iota_diff_t<X>; // <= compile errorMetadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingfixedSomething works now, yay!Something works now, yay!rangesC++20/23 rangesC++20/23 ranges