mirror of
https://github.com/gcc-mirror/gcc.git
synced 2026-05-06 14:59:39 +02:00
This implements LWG 4242 which was approved in Sofia 2025. I don't think the change from static_cast<const decay_t<I>&> to just static_cast<decay_t<I>> is observable, but it doesn't hurt. What fixes the problem identified in the issue is the is_array_v check, which avoids the static_cast entirely for volatile-qualified iterators. libstdc++-v3/ChangeLog: * include/bits/ranges_base.h (distance(It&&, Sent)): Only decay arrays to pointers when the type is actually an array, as per LWG 4242. * testsuite/24_iterators/range_operations/distance.cc: Add test for LWG 4242. Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>