[PATCH] libstdc++, testsuite: Implement C++26 P3450R1: Extend std::is_within_lifetime paper
Jakub Jelinek
jakub@redhat.com
Sat Sep 12 07:59:27 GMT 2026
On Fri, Sep 11, 2026 at 05:01:30PM +0200, Jakub Jelinek wrote:
> The following patch on top of either of the
> https://gcc.gnu.org/pipermail/gcc-patches/2026-September/730963.html
This one is now in.
> or
> https://gcc.gnu.org/pipermail/gcc-patches/2026-September/730509.html
> patches implements the C++26 P3450R1: Extend std::is_within_lifetime paper
> purely in library by using __builtin_constant_p to verify if the static_cast
> mandated by the standard is a constant expression.
>
> Tested on x86_64-linux (but sure, dependent on the static_cast constexpr
> diagnostics).
And this patch passed full bootstrap/regtest on both x86_64-linux and
i686-linux.
> 2026-09-11 Jakub Jelinek <jakub@redhat.com>
>
> libstdc++-v3/
> * include/bits/version.def (within_lifetime): Change value from 202306
> to 202603.
> * include/bits/version.h: Regenerate.
> * include/std/type_traits: Implement C++26 P3450R1: Extend
> std::is_within_lifetime paper.
> (std::is_within_lifetime): Add _Up template argument defaulted to void
> and verify static_cast<const volatile _Up*>(__p) is a constant
> expression.
> gcc/testsuite/
> * g++.dg/cpp26/within-lifetime1.C: Fix up C++26 paper number and name.
> * g++.dg/cpp26/within-lifetime2.C: Likewise.
> * g++.dg/cpp26/within-lifetime3.C: Likewise.
> * g++.dg/cpp26/within-lifetime4.C: Likewise.
> * g++.dg/cpp26/within-lifetime5.C: Likewise.
> * g++.dg/cpp26/within-lifetime6.C: Likewise.
> * g++.dg/cpp26/within-lifetime7.C: Likewise.
> * g++.dg/cpp26/within-lifetime8.C: Likewise.
> * g++.dg/cpp26/within-lifetime9.C: Likewise.
> * g++.dg/cpp26/within-lifetime10.C: New test.
> * g++.dg/cpp26/within-lifetime11.C: New test.
> * g++.dg/cpp26/within-lifetime12.C: New test.
Jakub
More information about the Libstdc++
mailing list