https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120305

--- Comment #10 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #7)
> An iota_view with unsigned long elements (i.e. 64-bit integers) must use
> something wider than 64 bits for the difference_type of its iterators. The
> C++20 standard allows that to be an integer type or an integer-like class
> type.
> 
> In strict standard-conforming mode, we do not use the non-standard __int128
> type for iota_view iterators, so we use an integer-like class type.

Sorry, I slightly misremembered the details and this is not quite correct. We
use __int128 for the difference_type even in strict mode. 

The problem is that the Cpp17InputIterator requirements require the iterator's
difference_type to be a standard integer type, and in struct modes __int128 is
not considered a standard integer type (it's a non-standard extension).

In non-strict -std=gnu++20 mode we consider __int128 to be a standard integer
type, and so iota iterators meet the Cpp17InputIterator requirements. 

So the end result is the same, the difference is just in the precise details of
*why* iota view iterators do not meet the Cpp17InputIterator requirements.

Reply via email to