public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely@redhat.com>
To: Jason Merrill <jason@redhat.com>
Cc: gcc-patches@gcc.gnu.org, libstdc++@gcc.gnu.org
Subject: Re: [PATCH RFC] c++: mangle function template constraints
Date: Wed, 22 Nov 2023 14:54:54 +0000	[thread overview]
Message-ID: <CACb0b4m+s40EtPbPdzesWZAU_Y1iXGAXupfbracTrBiNnXLKiw@mail.gmail.com> (raw)
In-Reply-To: <CACb0b4=vTSvd9tNDstGqfg-WMKUimu=Vn3Hrdo5JVYHeYD10WQ@mail.gmail.com>

On Wed, 22 Nov 2023 at 14:50, Jonathan Wakely <jwakely@redhat.com> wrote:
>
> On Mon, 20 Nov 2023 at 02:56, Jason Merrill wrote:
> >
> > Tested x86_64-pc-linux-gnu.  Are the library bits OK?  Any comments before I
> > push this?
>
> The library parts are OK.
>
> The variable template is_trivially_copyable_v just uses
> __is_trivially_copyable so should be just as efficient, and the change
> to <bit> is fine.
>
> The variable template is_trivially_destructible_v instantiates the
> is_trivially_destructible type trait, which instantiates
> __is_destructible_safe and __is_destructible_impl, which is probably
> why we used the built-in directly in <variant>. But that's an
> acceptable overhead to avoid using the built-in in a mangled context,
> and it would be good to optimize the variable template anyway, as a
> separate change.

For C++20 we could do:

#if __cpp_concepts
template <typename _Tp>
  inline constexpr bool is_trivially_destructible_v = false;
template <typename _Tp> requires (_Tp& __t) { __t.~_Tp(); }
  inline constexpr bool is_trivially_destructible_v<_Tp>
    = __has_trivial_destructor(_Tp);
#else
template <typename _Tp>
  inline constexpr bool is_trivially_destructible_v =
    is_trivially_destructible<_Tp>::value;
#endif

But that won't help C++17.


  reply	other threads:[~2023-11-22 14:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-20  2:55 Jason Merrill
2023-11-22 14:50 ` Jonathan Wakely
2023-11-22 14:54   ` Jonathan Wakely [this message]
2023-12-05 17:05   ` Jonathan Wakely
2024-01-07 16:40     ` Patrick Palka
2024-01-07 16:45       ` Jonathan Wakely

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CACb0b4m+s40EtPbPdzesWZAU_Y1iXGAXupfbracTrBiNnXLKiw@mail.gmail.com \
    --to=jwakely@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jason@redhat.com \
    --cc=libstdc++@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).