[PATCH] libstdc++: fix inplace_vector deprecation warning

Tomasz Kaminski tkaminsk@redhat.com
Fri Sep 11 05:54:36 GMT 2026


On Thu, Sep 10, 2026 at 10:57 PM Avi Kivity <avi@lists.scylladb.com> wrote:

> From: Avi Kivity <avi@scylladb.com>
>
> Practically anything that touches std::inplace_vector causes
> this warning to be generated:
>
> /usr/lib/gcc/x86_64-redhat-linux/16/../../../../include/c++/16/inplace_vector:853:20:
> warning: 'is_trivial_v<unsigned int>' is deprecated: use
> 'is_trivially_default_constructible_v && is_trivially_copyable_v' instead
> [-Wdeprecated-declarations]
>
I will remove the path, leaving only inplace_vector to reduce this already
long line.

>   853 |             if constexpr (is_trivial_v<_Tp>)
>       |                           ^
> /usr/lib/gcc/x86_64-redhat-linux/16/../../../../include/c++/16/inplace_vector:128:2:
> note: in instantiation of member function 'std::inplace_vector<unsigned
> int, 2>::_M_init' requested here
>   128 |         _M_init();
>       |         ^
>
> Fix it by following the warning's recommendation.
>
>         PR libstdc++/127325
>
> libstdc++-v3/ChangeLog:
>
>         * include/std/inplace_vector: replace is_trivial_v with
>         is_trivially_default_constructible_v and is_trivially_copyable_v.
>
> Signed-off-by: Avi Kivity <avi@scylladb.com>
>
> ---
> DisclAImer: I bravely typed this in on my own.

Thanks, as this is obvious fix, I will merge that to master and backport to
16.

>
>  libstdc++-v3/include/std/inplace_vector | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/libstdc++-v3/include/std/inplace_vector
> b/libstdc++-v3/include/std/inplace_vector
> index 6d67a740f21..a2b5f31be92 100644
> --- a/libstdc++-v3/include/std/inplace_vector
> +++ b/libstdc++-v3/include/std/inplace_vector
> @@ -860,11 +860,12 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
>  #endif
>           }
>         else
>           {
>             // TODO: use new(_M_elems) _Tp[_Nm]() once PR121068 is fixed
> -           if constexpr (is_trivial_v<_Tp>)
> +           if constexpr (is_trivially_default_constructible_v<_Tp>
> +                           && is_trivially_copyable_v<_Tp>)
>               for (size_t __i = 0; __i < _Nm; ++__i)
>                 _M_elems[__i] = _Tp();
>             else
>               __builtin_unreachable(); // only trivial types are supported
> at compile time
>           }
> --
> 2.55.0
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://gcc.gnu.org/pipermail/libstdc++/attachments/20260911/edbaa661/attachment.htm>


More information about the Libstdc++ mailing list