]> git.ipfire.org Git - thirdparty/gcc.git/commit
libstdc++: Fix std::deque::operator[] Xmethod [PR112491]
authorJonathan Wakely <jwakely@redhat.com>
Tue, 14 Nov 2023 15:08:13 +0000 (15:08 +0000)
committerJonathan Wakely <jwakely@redhat.com>
Wed, 15 Nov 2023 11:33:16 +0000 (11:33 +0000)
commitd5200963cadc267e8fc72bcc9f62bd038d353d62
treee5afbe5a0171e7ce9841b136b6f9a6f26b07c6e0
parentc665769c90f6e3844e6aad7b183480dfe2e7d8cc
libstdc++: Fix std::deque::operator[] Xmethod [PR112491]

The Xmethod for std::deque::operator[] has the same bug that I recently
fixed for the std::deque::size() Xmethod. The first node might have
unused capacity at the start, which needs to be accounted for when
indexing into the deque.

libstdc++-v3/ChangeLog:

PR libstdc++/112491
* python/libstdcxx/v6/xmethods.py (DequeWorkerBase.index):
Correctly handle unused capacity at the start of the first node.
* testsuite/libstdc++-xmethods/deque.cc: Check index operator
when elements have been removed from the front.

(cherry picked from commit 452476db0c705caeac8712d560fc16ced0ca5226)
libstdc++-v3/python/libstdcxx/v6/xmethods.py
libstdc++-v3/testsuite/libstdc++-xmethods/deque.cc