libstdc++: Fix subrange::advance and subrange::prev (LWG 3433)
authorPatrick Palka <ppalka@redhat.com>
Tue, 28 Apr 2020 20:34:24 +0000 (16:34 -0400)
committerPatrick Palka <ppalka@redhat.com>
Tue, 28 Apr 2020 20:43:23 +0000 (16:43 -0400)
commit19667c82e479dc2bf8351588ed57aff90220b748
tree68faf8abe56e6d001a1620a0dd8a9a43a7685b6a
parent69bc8815740de46869b45403b3b583e1e2c0e442
libstdc++: Fix subrange::advance and subrange::prev (LWG 3433)

This implements the proposed resolution of LWG 3433, which fixes
subrange::advance when called with a negative argument.

libstdc++-v3/ChangeLog:

LWG 3433 subrange::advance(n) has UB when n < 0
* include/std/ranges (subrange::prev): Fix typo.
(subrange::advance): Handle a negative argument as per the proposed
resolution of LWG 3433.
* testsuite/std/ranges/subrange/lwg3433.cc: New test.
libstdc++-v3/ChangeLog
libstdc++-v3/include/std/ranges
libstdc++-v3/testsuite/std/ranges/subrange/lwg3433.cc [new file with mode: 0644]