From patchwork Wed May 1 16:27:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 1930285 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=P5M8yMpp; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VV2ZP5DJnz1ymp for ; Thu, 2 May 2024 02:29:01 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id AE7BD3858C78 for ; Wed, 1 May 2024 16:28:59 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org 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 C5E2E3858D20 for ; Wed, 1 May 2024 16:28:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C5E2E3858D20 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 C5E2E3858D20 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=1714580919; cv=none; b=FM1gBM69sVWMWEQmLSBe/ErWJ++KwfyqWmMT/Zht+jUkSkRnTZXdoxhFU82GZzITU3XZEC5Jm++GFNuIm7FhkcVHaAK6Sz95ziWIptK7iENwASQzRBDVPuZbSZawj4kVuGiLTp0VWTnC8p/raMTOn7g6mOJ2ggpSsDl5443YRrY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1714580919; c=relaxed/simple; bh=TNblzmqGYgo/yQzLBfLuDm0yTNeQwcW46T01Xx1HpHs=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=PLe78Oz8O1SVhiuP7zvMjvUE4kGkRoutr8WCMexDQrjleISfSUD7yCE/XvWKLUKpo6O4MsjQ6WSf6ATLH49HYvS+0sP4HJ7FalyyRpDFbYPqT725MM/bdQsC3ylU0iKgA60DihRLC3IAKZoLLeoOnmboE/XL8bldzKQ4P2Qdpdk= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1714580917; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=bT4CvltQzZiT4X/SdjR6FsiRkGhsIK20TF22klkm/h0=; b=P5M8yMppJN19X5LjxU5gGM+vwb0NEBPSAQM3qLlWnNhkE8lq/KKfeQp6xmomIDpGj/ip5O HtY3IgTqWhyy89WZZ9CojHmgLkv0z4DAU0QZxK9AuW56xsFS8OVE9CPJX+wJgsjaCoYuov 84q9zfXEuDNTeqW1PwYlwpWBVuP1/gg= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-142-5qxvexmXMcGfGFY5Ig_ntg-1; Wed, 01 May 2024 12:28:35 -0400 X-MC-Unique: 5qxvexmXMcGfGFY5Ig_ntg-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5857E830D37; Wed, 1 May 2024 16:28:35 +0000 (UTC) Received: from localhost (unknown [10.42.28.238]) by smtp.corp.redhat.com (Postfix) with ESMTP id 284D540C6CC0; Wed, 1 May 2024 16:28:35 +0000 (UTC) From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed] libstdc++: Guard uses of is_pointer_interconvertible_v [PR114891] Date: Wed, 1 May 2024 17:27:55 +0100 Message-ID: <20240501162834.3282221-1-jwakely@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Tested x86_64-linux. Pushed to trunk. I'll backport this to gcc-14 as well, but it can wait until after the 14.1 release. -- >8 -- This type trait isn't supported by Clang 18. It's only used in static assertions, so they can just be omitted if the trait isn't available. libstdc++-v3/ChangeLog: PR libstdc++/114891 * include/std/generator: Check feature test macro before using is_pointer_interconvertible_v. --- libstdc++-v3/include/std/generator | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libstdc++-v3/include/std/generator b/libstdc++-v3/include/std/generator index 789016b5a88..1d5acc91420 100644 --- a/libstdc++-v3/include/std/generator +++ b/libstdc++-v3/include/std/generator @@ -322,8 +322,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template auto await_suspend(std::coroutine_handle<_Promise> __c) noexcept { +#ifdef __glibcxx_is_pointer_interconvertible static_assert(is_pointer_interconvertible_base_of_v< _Promise_erased, _Promise>); +#endif auto& __n = __c.promise()._M_nest; return __n._M_pop(); @@ -344,8 +346,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template void await_suspend(std::coroutine_handle<_Promise>) noexcept { +#ifdef __glibcxx_is_pointer_interconvertible static_assert(is_pointer_interconvertible_base_of_v< _Promise_erased, _Promise>); +#endif _M_bottom_value = ::std::addressof(_M_value); } @@ -375,8 +379,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION std::coroutine_handle<> await_suspend(std::coroutine_handle<_Promise> __p) noexcept { +#ifdef __glibcxx_is_pointer_interconvertible static_assert(is_pointer_interconvertible_base_of_v< _Promise_erased, _Promise>); +#endif auto __c = _Coro_handle::from_address(__p.address()); auto __t = _Coro_handle::from_address(this->_M_gen._M_coro.address()); @@ -685,8 +691,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { return { coroutine_handle::from_promise(*this) }; } }; +#ifdef __glibcxx_is_pointer_interconvertible static_assert(is_pointer_interconvertible_base_of_v<_Erased_promise, promise_type>); +#endif generator(const generator&) = delete;