From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 0C3A438582BD for ; Wed, 22 Nov 2023 14:55:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0C3A438582BD Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 0C3A438582BD Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700664910; cv=none; b=py9JC3jLqtAe2kPbQHC4HegUlPVVif+TfETM0pWdV/C4dnZsssk1djP1sc3QNLBl3PlDy/7o/Wh1hTGf6UmeQpqNEiEl0zCn3NKR3DcapIXtzzUaQL0AXoz2pzPHQ475JQsVXFYnVV+7eRT+Mzv73F3xSwrKai9Qqdy7MrK1ErI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700664910; c=relaxed/simple; bh=kHYd+UhHZM2Pja9v2CgisIo285ong7ElIOF/W7nvqnk=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=BWcce7Gm5W9SJvJxrpwGZsF6ulX47Ny9ftlwoXAd242t8VNZrbARIJRV/f2732ZNTh6Vf2WYFpSPAyxFSFctwXsPTQDSmGgG1WRQxsmsZGD2NIxR9k8MgAGGUmd1bTdQ2E3CPZVyFu/BDStF0jf/kr+drgBMQg10YVK+SYpWTYo= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1700664907; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=ysV0lz6Hcn358mzl16g/bDa4itegH6YEl0llI6l7Pac=; b=IXv49+2O8KA9/Y03e2nXESdqWpsHX3GZULgbdwMxcqsj75mVVcMNztC2zvI+yNf+LNgmM4 nojGWuOHXlXJihJsGPhqyVBsXOTuaapdkJaX64PAu/jetCBM52GunROaaz/ILkcDNeDXxm e2buee8836tXCcAFvXwPluSGExqtoe0= Received: from mail-yw1-f200.google.com (mail-yw1-f200.google.com [209.85.128.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-498--TvwEdN6MS6BdBAOyVYBbA-1; Wed, 22 Nov 2023 09:55:06 -0500 X-MC-Unique: -TvwEdN6MS6BdBAOyVYBbA-1 Received: by mail-yw1-f200.google.com with SMTP id 00721157ae682-5cc3e334d16so22710937b3.3 for ; Wed, 22 Nov 2023 06:55:06 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700664905; x=1701269705; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ysV0lz6Hcn358mzl16g/bDa4itegH6YEl0llI6l7Pac=; b=OaVpoQr5mkBtkfhk34ZvZ3AmPZ+X5vBY7cqhW+g1GG7rioikzobDm08qfJLkDQC9eI SLWTVPapOn4i2iOQVXuwyfkV+I3KfGg+YJ8wL/6Xa6wOWzJ1fs8spcHaQzwYNpp7KElp ZWadSezWglGHB0MGWW449+SSJ1OJAHgtGEtV//qC+UdSAWp6qB5cyPmpD1W3akXq9tMT diFwjMbOurHG8U1kPmOihO5MFKX5kjjp34d3oM3Grxkb9S9OdIPvJBlZPp/nWr6xcXFz fqvjvouQRKfMQ8grGVJ/zvJxb5xWHpFlX1iyxCi1i5y1HVp4OGK9Ijgd2iW8AlyMmyhD teLQ== X-Gm-Message-State: AOJu0YyoYvmdcrJKWPLtmPR0n9RKTiSNdB5SrHeuUHDXNZ5Z1WJIDkKi DYILL5WCKWza2NFx+JKAPs7jdEfPtaTFH4Rx5Knm3ZGr9AzNUIUCbAdo8RPlDHiFsq7gb59Pgka HBL6LyMWCKa1EoHNQQSjY2HlDazFde9A/RQ== X-Received: by 2002:a81:a18d:0:b0:5cb:332e:ab68 with SMTP id y135-20020a81a18d000000b005cb332eab68mr2364390ywg.5.1700664905762; Wed, 22 Nov 2023 06:55:05 -0800 (PST) X-Google-Smtp-Source: AGHT+IHwbf5KgNnVJHl25yDWXhxqd9muCU4USvV7zVjUwrS3060q3uJK/h+giHZRQ2YxQWGdiI2kvct4SaJBJLY68go= X-Received: by 2002:a81:a18d:0:b0:5cb:332e:ab68 with SMTP id y135-20020a81a18d000000b005cb332eab68mr2364376ywg.5.1700664905538; Wed, 22 Nov 2023 06:55:05 -0800 (PST) MIME-Version: 1.0 References: <20231120025547.2938444-1-jason@redhat.com> In-Reply-To: From: Jonathan Wakely Date: Wed, 22 Nov 2023 14:54:54 +0000 Message-ID: Subject: Re: [PATCH RFC] c++: mangle function template constraints To: Jason Merrill Cc: gcc-patches@gcc.gnu.org, libstdc++@gcc.gnu.org X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-6.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Wed, 22 Nov 2023 at 14:50, Jonathan Wakely 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 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 . 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 inline constexpr bool is_trivially_destructible_v = false; template requires (_Tp& __t) { __t.~_Tp(); } inline constexpr bool is_trivially_destructible_v<_Tp> = __has_trivial_destructor(_Tp); #else template inline constexpr bool is_trivially_destructible_v = is_trivially_destructible<_Tp>::value; #endif But that won't help C++17.