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.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 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=1661879661; 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: content-transfer-encoding:content-transfer-encoding; bh=4CqkWk9Br0GE4fqT1jLeqIw0AC/30RMx6r5UxXV16T0=; b=f4bWFLtIIGYQ0udbkUwEKqzRm1ZQPKUgaPR3XfrEEDP0tDhrvbZrCYw6rkrdhj3xFGbmM1 zZkmV7YFVrVu9qI1H3n3JV3aJN6yTCv+DxPYSVAFzWXPl5D/39cPD3PlqgcioyHFhhWM6B mNGLICRC3lIyi+vACbnyHVpXNBdNZyE= 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-Google-Smtp-Source: AA6agR4PeEAiqERDljAaqn6ZjypYGTfdfMweyelZv8dJ4YKCILYWqTAR5eTEoUPU7JeSwYWkMOtq8Q== 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) From: Patrick Palka To: gcc-patches@gcc.gnu.org Cc: libstdc++@gcc.gnu.org, Patrick Palka 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 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true 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 List-Id: 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); -- 2.37.2.490.g6c8e4ee870