On Fri, Sep 5, 2025 at 2:25 PM Jonathan Wakely <jwak...@redhat.com> wrote:

> On Fri, 5 Sept 2025 at 08:14, Tomasz Kamiński <tkami...@redhat.com> wrote:
> >
> > From: Luc Grosheintz <luc.groshei...@gmail.com>
> >
> > This is a partial implementation of P2781R9. It adds std::cw and
> > std::constant_wrapper, but doesn't modify __integral_constant_like for
> > span/mdspan.
> >
> > libstdc++-v3/ChangeLog:
> >
> >         * include/bits/version.def (constant_wrapper): Add.
> >         * include/bits/version.h: Regenerate.
> >         * include/std/type_traits (_CwFixedValue): New class.
> >         (_IndexSequence): New struct.
> >         (_BuildIndexSequence): New struct.
> >         (_ConstExprParam): New concept.
> >         (_CwOperators): New struct.
> >         (constant_wrapper): New struct.
> >         (cw): New global constant.
> >         * src/c++23/std.cc.in (constant_wrapper): Add.
> >         (cw): Add.
> >         * testsuite/20_util/constant_wrapper/adl.cc: New test.
> >         * testsuite/20_util/constant_wrapper/ex.cc: New test.
> >         * testsuite/20_util/constant_wrapper/generic.cc: New test.
> >         * testsuite/20_util/constant_wrapper/instantiate.cc: New test.
> >         * testsuite/20_util/constant_wrapper/op_comma_neg.cc: New test.
> >         * testsuite/20_util/constant_wrapper/version.cc: New test.
> >
> > Co-authored-by: Tomasz Kamiński <tkami...@redhat.com>
> > Signed-off-by: Luc Grosheintz <luc.groshei...@gmail.com>
> > Signed-off-by: Tomasz Kamiński <tkami...@redhat.com>
> > ---
> > v5 adds data member pointer tests
>
> This adds a lot of new code to <type_traits> which needs to be
> preprocessed even by C++11/14/17/20/23 programs, so we might want to
> put it in a separate header that is included from <type_traits>
> conditionally:
> #ifdef __cpp_lib_constant_wrapper
> #include <bits/constant_wrapper.h>
> #endif
> but we can do that later, as splitting up <type_traits> is already
> planned (maybe we should look into that for GCC 16 during stage 3,
> when we're stabilising things).
>
I have raised this during review of the patch
https://gcc.gnu.org/pipermail/libstdc++/2025-September/063202.html.
Luc pointed out that  would need to also move _Build_index_type somewhere
where it can be included from
the new file, or just assume it is declared before including
`bits/constant_wrapper` (i.e. included in the middle
of the file). This convinced me that this is something we should take into
consideration when splitting
type_traits.


>
> OK for trunk, thank you both for working on this.
>
>

Reply via email to