On Thu, 5 Mar 2026 at 23:02, Thor Preimesberger
<[email protected]> wrote:
>
> With Tomasz' comments from last time. I (at least tried to :P)
> implemented everything except for getting the tests to function
> properly with -D_GLIBCXX_DEBUG. I think we think we may want to hold
> off on marking all the debug stuff constexpr until all other
> containers are finished; I think it's technically do-able now, but it
> involves fussing with the test infrastructure in a way that should be
> more convenient to do later.
>
> I have some other patches bitrotting on my computer that make partial
> progress towards P3372. I'll eventually get around to sending them
> in, but feel free to email me if interested on taking them further ^^
>
> Testsuite works on my x86_64 machine.
> --- 8< ---
> This patch makes partial progress towards P3372 by marking
> std::{deque, priority_queue, queue} and relevant internal helpers to be
> constexpr when using C++26. Although the debug versions of deque are
> marked as constexpr, the rest of the debug functionality in libstdc++
> still needs to be marked constexpr as well. So our tests are xfail with
> -D_GLIBCXX_DEBUG for now.
>
> libstdc++-v3/ChangeLog:
>
> * include/Makefile.am: Have stdc++.h precompiled header build
> * with --std=gnu++2c due to symbol changes in stl_algobase.h

Please check the GNU ChangeLog format, you do not start every line
with an asterisk.


> * include/bits/deque.tcc: Mark constexpr; note that those
> * functions in stl_algobase.h are marked as CXX20 constexpr only.
> * include/bits/stl_algobase.h: Mark deque helper functions CXX20
> * constexpr.
> * include/bits/stl_deque.h: Mark CXX26 constexpr.
> * include/bits/stl_queue.h: Mark CXX26 constexpr.
> * include/bits/stl_uninitialized.h: Mark helper
> * __uninitialized_default_a CXX26 constexpr.
> * include/bits/version.def: Add feature test macros for
> * __cpp_lib_constexpr_{queue, dequeue}.
> * include/bits/version.h: Regenerate.
> * include/debug/deque: Mark member functions CXX26 constexpr.
> * include/std/deque: Mark nonmember functions CXX26 constexpr
> * and add macros.
> * include/std/queue: Mark nonmember functions CXX26 constexpr
> * and add macros.
> * testsuite/23_containers/deque/constexpr.cc: New test.
> * testsuite/23_containers/deque/debug/constexpr.cc: New test.
> * testsuite/23_containers/priority_queue/constexpr.cc: New test.
> * testsuite/23_containers/queue/constexpr.cc: New test.
>
> Signed-off-by: Thor Preimesberger <[email protected]>
> ---
>  libstdc++-v3/include/Makefile.am              |   2 +-
>  libstdc++-v3/include/bits/deque.tcc           |  53 +++
>  libstdc++-v3/include/bits/stl_algobase.h      |  16 +-
>  libstdc++-v3/include/bits/stl_deque.h         | 168 +++++++-
>  libstdc++-v3/include/bits/stl_queue.h         |  73 +++-
>  libstdc++-v3/include/bits/stl_uninitialized.h |   2 +
>  libstdc++-v3/include/bits/version.def         |  16 +
>  libstdc++-v3/include/bits/version.h           |  20 +
>  libstdc++-v3/include/debug/deque              |  72 ++++
>  libstdc++-v3/include/std/deque                |   4 +-
>  libstdc++-v3/include/std/queue                |  12 +-
>  .../23_containers/deque/constexpr.cc          | 348 +++++++++++++++++
>  .../23_containers/deque/debug/constexpr.cc    | 361 ++++++++++++++++++
>  .../23_containers/priority_queue/constexpr.cc | 323 ++++++++++++++++
>  .../23_containers/queue/constexpr.cc          | 281 ++++++++++++++
>  15 files changed, 1737 insertions(+), 14 deletions(-)
>  create mode 100644 libstdc++-v3/testsuite/23_containers/deque/constexpr.cc
>  create mode 100644
> libstdc++-v3/testsuite/23_containers/deque/debug/constexpr.cc
>  create mode 100644
> libstdc++-v3/testsuite/23_containers/priority_queue/constexpr.cc
>  create mode 100644 libstdc++-v3/testsuite/23_containers/queue/constexpr.cc
>
> diff --git a/libstdc++-v3/include/Makefile.am 
> b/libstdc++-v3/include/Makefile.am
> index e6ac312ac7a..62f4b6862bc 100644
> --- a/libstdc++-v3/include/Makefile.am
> +++ b/libstdc++-v3/include/Makefile.am
> @@ -1481,7 +1481,7 @@ ${host_builddir}/gthr-default.h:
> ${toplevel_srcdir}/libgcc/${thread_header} \
>  # Build two precompiled C++ includes, stdc++.h.gch/*.gch
>  ${pch1a_output}: ${allstamped} ${host_builddir}/c++config.h ${pch1_source}
>   -mkdir -p ${pch1_output_builddir}
> - $(CXX) $(PCHFLAGS) $(AM_CPPFLAGS) -O2 -g -std=gnu++0x ${pch1_source} \
> + $(CXX) $(PCHFLAGS) $(AM_CPPFLAGS) -O2 -g -std=gnu++2c ${pch1_source} \
>   -o $@
>
>  ${pch1b_output}: ${allstamped} ${host_builddir}/c++config.h ${pch1_source}

Why is this change needed at all?


> @@ -268,6 +287,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>         *  element of the %queue.
>         */
>        _GLIBCXX_NODISCARD
> +      _GLIBCXX26_CONSTEXPR

Please put the two macros on the same line (see countless examples
e.g. in bits/stl_vector.h)

Reply via email to