[committed][_GLIBCXX_DEBUG] Simplify constant-evaluated checks

Jonathan Wakely jwakely.gcc@gmail.com
Mon Sep 14 18:19:44 GMT 2026


Thanks!

On Mon, 14 Sept 2026, 19:00 François Dumont, <frs.dumont@gmail.com> wrote:

>
> On 9/14/26 19:28, Jonathan Wakely wrote:
> > On Mon, 14 Sept 2026 at 18:19, François Dumont<frs.dumont@gmail.com>
> wrote:
> >> Hi
> >>
> >> On a previous patch Jonathan spotted that in _GLIBCXX_DEBUG
> >> implementation of inplace_vector we could use the builtin constant
> >> evaluated checks rather than the library equivalent.
> >>
> >> So here is this simplification outside any patch.
> >>
> >>       libstdc++: [_GLIBCXX_DEBUG] Simplify constant-evaluated checks
> >>
> >>       In the C++26std::__debug::inplace_vector implementation we can
> use:
> >>
> >>       if consteval
> >>       {
> >>         ...
> >>       }
> > Everywhere else (well, almost everywhere) we put the opening brace on
> > the same line as 'if consteval'
>
> I won't use this 'almost' as an excuse.
>
> Now fixed, sorry.
>
>      libstdc++: [_GLIBCXX_DEBUG] Fix coding style on if consteval
>
>      Coding style imposes curly brasses to be open on same line, like this:
>
>      if consteval {
>        ....
>      }
>
>      libstdc++-v3/ChangeLog:
>
>              * include/debug/inplace_vector: Apply proper coding style
> on all
>              'if consteval' expressions.
>
> >>       rather than:
> >>
> >>       if (std::is_constant_evaluated())
> >>
> >>       libstdc++-v3/ChangeLog:
> >>
> >>               * include/debug/inplace_vector
> >>               (inplace_vector::emplace): Replace usages of
> >> std::is_constant_evaluated
> >>               by consteval.
> >>               (inplace_vector::insert): Likewise.
> >>               (inplace_vector::erase): Likewise.
> >>
> >> Tested under Linux x86_64 _GLIBCXX_DEBUG mode.
> >>
> >> 2 tests are already failing on master, I'm working on this independently
> >> of this patch.
> >>
> >> François
> >>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://gcc.gnu.org/pipermail/libstdc++/attachments/20260914/787f8b8d/attachment-0001.htm>


More information about the Libstdc++ mailing list