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 1AD043857730 for ; Fri, 15 Sep 2023 09:27:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1AD043857730 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1694770061; 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=X7m1aA0vzI6EaUdr+Qty4Z7xNvkvXZS2xnIH3PRawj8=; b=V/+iV6UTerJEwufEBFl+RroWuX+Ut9lhTAndMz67H2L+xB+PocZxYWofAMVp0e+kc1PgKF bL8wUEtCWd2yfARJmBxFIuYulnSAGY0XYYxG85ZM8vgg72QPNysFwN5SXm8+QuND4i1bgE Fn3EW/Nn/IECClFOVxBk8XmAgjybVfc= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-686-ufd52GomONWAfzn4VFgvUA-1; Fri, 15 Sep 2023 05:27:38 -0400 X-MC-Unique: ufd52GomONWAfzn4VFgvUA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 70D98811E7B; Fri, 15 Sep 2023 09:27:38 +0000 (UTC) Received: from localhost (unknown [10.42.28.190]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3699F40C2070; Fri, 15 Sep 2023 09:27:38 +0000 (UTC) From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed] libstdc++: Remove non-void static assertions in variant's std::get [PR111172] Date: Fri, 15 Sep 2023 10:26:48 +0100 Message-ID: <20230915092737.2192232-1-jwakely@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.8 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_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Tested x86_64-linux. Pushed to trunk. This would be safe to backport and slightly improve compile times. -- >8 -- A void template argument would cause a substitution failure when trying to form a reference for the return type, so the function body would never be instantiated. libstdc++-v3/ChangeLog: PR libstdc++/111172 * include/std/variant (get): Remove !is_void static assertions. --- libstdc++-v3/include/std/variant | 4 ---- 1 file changed, 4 deletions(-) diff --git a/libstdc++-v3/include/std/variant b/libstdc++-v3/include/std/variant index 7cb7c3b1d4d..36eec8d829b 100644 --- a/libstdc++-v3/include/std/variant +++ b/libstdc++-v3/include/std/variant @@ -1123,7 +1123,6 @@ namespace __variant { static_assert(__detail::__variant::__exactly_once<_Tp, _Types...>, "T must occur exactly once in alternatives"); - static_assert(!is_void_v<_Tp>, "_Tp must not be void"); constexpr size_t __n = std::__find_uniq_type_in_pack<_Tp, _Types...>(); return std::get<__n>(__v); } @@ -1134,7 +1133,6 @@ namespace __variant { static_assert(__detail::__variant::__exactly_once<_Tp, _Types...>, "T must occur exactly once in alternatives"); - static_assert(!is_void_v<_Tp>, "_Tp must not be void"); constexpr size_t __n = std::__find_uniq_type_in_pack<_Tp, _Types...>(); return std::get<__n>(std::move(__v)); } @@ -1145,7 +1143,6 @@ namespace __variant { static_assert(__detail::__variant::__exactly_once<_Tp, _Types...>, "T must occur exactly once in alternatives"); - static_assert(!is_void_v<_Tp>, "_Tp must not be void"); constexpr size_t __n = std::__find_uniq_type_in_pack<_Tp, _Types...>(); return std::get<__n>(__v); } @@ -1156,7 +1153,6 @@ namespace __variant { static_assert(__detail::__variant::__exactly_once<_Tp, _Types...>, "T must occur exactly once in alternatives"); - static_assert(!is_void_v<_Tp>, "_Tp must not be void"); constexpr size_t __n = std::__find_uniq_type_in_pack<_Tp, _Types...>(); return std::get<__n>(std::move(__v)); } -- 2.41.0