Re: [PATCH] libstdc++: Fix iota_view::size() to avoid overflow

2020-08-24 Thread Jonathan Wakely via Gcc-patches
On 20/08/20 19:54 +0100, Jonathan Wakely wrote: This avoids overfow that occurs when negating the most negative value of an integral type. Also prevent returning signed int when the values have lower rank and promote to int. libstdc++-v3/ChangeLog: * include/std/ranges (ranges::iota_vi

[PATCH] libstdc++: Fix iota_view::size() to avoid overflow

2020-08-20 Thread Jonathan Wakely via Gcc-patches
This avoids overfow that occurs when negating the most negative value of an integral type. Also prevent returning signed int when the values have lower rank and promote to int. libstdc++-v3/ChangeLog: * include/std/ranges (ranges::iota_view::size()): Perform all calculations in t