diff options
author | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2025-02-25 18:23:55 +0000 |
---|---|---|
committer | Jonathan Wakely <redi@gcc.gnu.org> | 2025-02-25 22:34:24 +0000 |
commit | ff43f9853d3b10e0d2694cd607da1056cb80f38a (patch) | |
tree | ad583e7e2c4d4296752896813827cf15dcc4f228 /gcc/fortran/trans-expr.cc | |
parent | 6a30ffd759ba004c77c7e37520659e9ab0eb80cc (diff) | |
download | gcc-ff43f9853d3b10e0d2694cd607da1056cb80f38a.zip gcc-ff43f9853d3b10e0d2694cd607da1056cb80f38a.tar.gz gcc-ff43f9853d3b10e0d2694cd607da1056cb80f38a.tar.bz2 |
libstdc++: add support for constexpr stable_sort (P2562R1)
stable_sort has been made constexpr in C++26. Apart from plastering a
few functions with constexpr, there's an implementation challenge, that
is: stable_sort takes different codepaths in case extra memory can be
allocated. Rather than doing some major refactorings, simply use the
non-allocating path during constant evaluation. That's the same codepath
used when extra memory could not be allocated, as well as by
freestanding.
libstdc++-v3/ChangeLog:
* include/bits/algorithmfwd.h (stable_sort): Add constexpr.
* include/bits/ranges_algo.h (__stable_sort_fn): Add constexpr
to the function call operators.
* include/bits/stl_algo.h (__stable_sort): Add constexpr.
During constant evaluation, always use the non-allocating path.
(stable_sort): Add constexpr.
(__inplace_stable_sort): Likewise.
(__merge_without_buffer): Likewise.
* include/bits/version.def (constexpr_algorithms): Bump value
for C++26.
* include/bits/version.h: Regnerate.
* testsuite/25_algorithms/cpp_lib_constexpr.cc: Test the bumped
feature-testing macro.
* testsuite/25_algorithms/headers/algorithm/synopsis.cc: Adapt
the test to constexpr stable_sort.
* testsuite/25_algorithms/stable_sort/constexpr.cc: New test.
Signed-off-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Diffstat (limited to 'gcc/fortran/trans-expr.cc')
0 files changed, 0 insertions, 0 deletions