From patchwork Tue Aug 30 17:14:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Palka X-Patchwork-Id: 846 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:ecc5:0:0:0:0:0 with SMTP id s5csp1901840wro; Tue, 30 Aug 2022 10:16:09 -0700 (PDT) X-Google-Smtp-Source: AA6agR7aR5CkV2IeJkkUeY09CNWJK5OQCBo4mkUOIsk7v/Jp7FmTRiXRyOxUF8/Xu/Fy62PNfaNc X-Received: by 2002:a17:906:7007:b0:6ff:8028:42e with SMTP id n7-20020a170906700700b006ff8028042emr17995245ejj.278.1661879769212; Tue, 30 Aug 2022 10:16:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661879769; cv=none; d=google.com; s=arc-20160816; b=vjxGi+XYSwL+PUHnfKDH5elaJJqFHnL6s2V4GZhkCwDYbIGC0QqL4nKH/GOvBalHXp q+PTp8HEpklyLgYWsW6RCQ+si+FIZVto8rAlGYOFVZgDWmKUhNI9gJfBkxus7w0u93r2 h3O+3cDNUtJJ2IU4OxK8m7PCXKq+hnEkz+2/VKvbX6RaortkjUAKXDnCYr0r/kQUPqTz XG5wlMu6+WI/YIBHbTzu74UDdl8Nmd8gItr9Vhpj1jums5LDBun37pCsR5mMbmbdf4h8 KNcMZ9TRqN90Au3dOk9IQghW21qNMayW0V6/OT9L1M/Ua3PiHyRG0A0HKFf/d01Ti9g4 pTiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:reply-to:from:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:to :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=4CqkWk9Br0GE4fqT1jLeqIw0AC/30RMx6r5UxXV16T0=; b=rCG9fuEdhc4Hs87vb16QhO35qROVMAuwL5n7Qcv6KBOz9MwIUSOou4DIgZlWVmHqDv YjOwZJCwonp+3m9mp1Sk+30APm2i2aN1QJOiw2kfvpmO2l2JIu+vMSfd08sLj6GJc5T1 TE2ywN8KVkXc/R6U0Ovq2aEII/vY8wYVdpQTkLBp/yvuMAM1Jcku12Wj8qLdhjeLaK6H AfEnUrpQYQC04NTw+jO+SyG7MaFrJBGCSxMt2LJbbsSXLkMG24XR1oUp+zyY9Z7FL9L4 6nFas/aSSlGryNfhkrN1PigLdVt77EhhEonbLr1lZNlk4UtTCYL3ztpXghWyhhCbsKtE PQUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=GrVXU4YI; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id p9-20020a50cd89000000b00446cd5b771dsi9579014edi.223.2022.08.30.10.16.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Aug 2022 10:16:09 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=GrVXU4YI; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id CDDE13AAA054 for ; Tue, 30 Aug 2022 17:15:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CDDE13AAA054 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1661879705; bh=4CqkWk9Br0GE4fqT1jLeqIw0AC/30RMx6r5UxXV16T0=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=GrVXU4YIBTGZq8S4eETo8WUOHAx9ZKW4v6btqtZM7v261o5+PaZPLwzPWOKKIt3sQ WC9j8ddvFq2j6ThZ8JigtSG3Tb1eNcqBY8JdGwyhEPIWk41C/BGUCcC1NgM9TDd8FI 6u5iYeMBO3DJ86DTpESv8gM1Qm9B9UPudiLS8x7M= 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.129.124]) by sourceware.org (Postfix) with ESMTPS id CE3F03959C5D for ; Tue, 30 Aug 2022 17:14:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org CE3F03959C5D Received: from mail-qt1-f199.google.com (mail-qt1-f199.google.com [209.85.160.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-237-y6bike-wObWgh1WG-XrCgg-1; Tue, 30 Aug 2022 13:14:19 -0400 X-MC-Unique: y6bike-wObWgh1WG-XrCgg-1 Received: by mail-qt1-f199.google.com with SMTP id z6-20020ac875c6000000b0034454b14c91so9305269qtq.15 for ; Tue, 30 Aug 2022 10:14:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date; bh=4CqkWk9Br0GE4fqT1jLeqIw0AC/30RMx6r5UxXV16T0=; b=FSO1um8SswFF7DBtOL97l71WMJyHmG8Cv2mamkMx1nm89ZRJbEogOqlmgm4k7aLTmi 36S8eIDkvhQ4RhZQNmU+VClMY9imRU26ZXhdOmdgw5qAT2lHAwVAUzRfTlyYT2VeJ5pg cOO2Jys8xgLE+abhstozNFL4CQ3JkkNO4ACZgNRyMeAWlvxdbfZDS812ow+vMnfagmV1 NNSk2vrzJY33+o99mHuI/faAB1c2o0x3Jcv9dJrpdgRhJn2h2bUedh6860gN3bzgPnQj 0+wKsrD5UffGyT46H2QNy3ZI0xJPO5TvecoFVdigodsTHvWBiaDzvW53zajRy11KhBsd GUAA== X-Gm-Message-State: ACgBeo3EbhWF+Ge9zKUeQlJQJr7lJDMszYLL1qO34UgO4VeruheI8Dsg iRTK0aIWtb8TWl3GfVM63W8Zd3EO8djK1ByHtFLfqWYnXo7KnAb4q6vAMAZcTKDdRQvgti9PYvN z/BgI0BHXt0mhdKxlR9nP6BKQFZGz1qkVJOl4KEWzh8Y1FQ4pC14R/MQQJdA0FJv+JEQ= X-Received: by 2002:a05:620a:488e:b0:6bb:3f84:d175 with SMTP id ea14-20020a05620a488e00b006bb3f84d175mr12555303qkb.587.1661879658815; Tue, 30 Aug 2022 10:14:18 -0700 (PDT) X-Received: by 2002:a05:620a:488e:b0:6bb:3f84:d175 with SMTP id ea14-20020a05620a488e00b006bb3f84d175mr12555282qkb.587.1661879658507; Tue, 30 Aug 2022 10:14:18 -0700 (PDT) Received: from localhost.localdomain (ool-457670bb.dyn.optonline.net. [69.118.112.187]) by smtp.gmail.com with ESMTPSA id br18-20020a05620a461200b006bb0f9b89cfsm8417229qkb.87.2022.08.30.10.14.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Aug 2022 10:14:18 -0700 (PDT) To: gcc-patches@gcc.gnu.org Subject: [PATCH] libstdc++: Add test for std::con/disjunction's short circuiting Date: Tue, 30 Aug 2022 13:14:16 -0400 Message-Id: <20220830171416.54524-1-ppalka@redhat.com> X-Mailer: git-send-email 2.37.2.490.g6c8e4ee870 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-14.5 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_LOW, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=unavailable 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.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Patrick Palka via Gcc-patches From: Patrick Palka Reply-To: Patrick Palka Cc: libstdc++@gcc.gnu.org Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1742607240862013234?= X-GMAIL-MSGID: =?utf-8?q?1742607240862013234?= Tested on x86_64-pc-linux-gnu, does this look OK for trunk? libstdc++-v3/ChangeLog: * testsuite/20_util/logical_traits/requirements/short_circuit.cc: New test. --- .../requirements/short_circuit.cc | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 libstdc++-v3/testsuite/20_util/logical_traits/requirements/short_circuit.cc diff --git a/libstdc++-v3/testsuite/20_util/logical_traits/requirements/short_circuit.cc b/libstdc++-v3/testsuite/20_util/logical_traits/requirements/short_circuit.cc new file mode 100644 index 00000000000..b6a8091cdb0 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/logical_traits/requirements/short_circuit.cc @@ -0,0 +1,32 @@ +// { dg-do compile { target c++17 } } + +#include + +template struct A { using type = typename T::type; }; +using invalid = A; + +// [meta.logical]/3: For a specialization conjunction, if +// there is a template type argument B_i for which bool(B_i::value) is false, +// then instantiating conjunction::value does not require the +// instantiation of B_j::value for j > i. + +static_assert(!std::conjunction_v); +static_assert(!std::conjunction_v); +static_assert(!std::conjunction_v); + +static_assert(!std::conjunction_v); +static_assert(!std::conjunction_v); +static_assert(!std::conjunction_v); + +// [meta.logical]/8: For a specialization disjunction, if +// there is a template type argument B_i for which bool(B_i::value) is true, +// then instantiating disjunction::value does not require the +// instantiation of B_j::value for j > i. + +static_assert(std::disjunction_v); +static_assert(std::disjunction_v); +static_assert(std::disjunction_v); + +static_assert(std::disjunction_v); +static_assert(std::disjunction_v); +static_assert(std::disjunction_v);