]> git.ipfire.org Git - thirdparty/gcc.git/commit
libstdc++: Fix ranges::stable_sort handling of null buffer [PR123180]
authorJonathan Wakely <jwakely@redhat.com>
Thu, 18 Dec 2025 10:38:31 +0000 (10:38 +0000)
committerJonathan Wakely <redi@gcc.gnu.org>
Thu, 18 Dec 2025 13:47:25 +0000 (13:47 +0000)
commit630c1bfbb5bc3ba9fafca5e97096263ab8f0a04b
tree65050f0d8605d43083674c579170cdbbbe380adc
parent1ed9526113c970126ca710b516e5260a25f1def9
libstdc++: Fix ranges::stable_sort handling of null buffer [PR123180]

The logic of the null pointer check got reversed when converting the
std::stable_sort code for ranges::stable_sort.

libstdc++-v3/ChangeLog:

PR libstdc++/123180
* include/bits/ranges_algo.h (__stable_sort_fn::operator()): Fix
sense of null check. Replace typedef with alias-declaration.
* testsuite/25_algorithms/stable_sort/123180.cc: New test.

Reviewed-by: Patrick Palka <ppalka@redhat.com>
libstdc++-v3/include/bits/ranges_algo.h
libstdc++-v3/testsuite/25_algorithms/stable_sort/123180.cc [new file with mode: 0644]