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 353843AA88E8 for ; Tue, 30 Aug 2022 17:14:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 353843AA88E8 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=1661879660; 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=X0+oSzJAGlU+wnGJRkh9SjO8v6aLI2cOVxd8MXmhs+tTaURrE7Z8lDBrO4//58Q3dUsrcs +g0qbF8IpmJZiDv3AixW6Uh9F9usJ/9dPEd2/jo9X847quYRK4gazCyTHNw81c3XNn4VlV QdupX5F8/WV7zuuX/r2CmvvBgUtd7ws= Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-568-Elc0ic92P4iX7YPl5QlGBg-1; Tue, 30 Aug 2022 13:14:19 -0400 X-MC-Unique: Elc0ic92P4iX7YPl5QlGBg-1 Received: by mail-qk1-f197.google.com with SMTP id w22-20020a05620a445600b006bb7f43d1cfso9704770qkp.16 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=icnGEiu3zYwSmRBveWwlhp2E+FHhLjZJnorvpeIM84ej7AZxOnU8djuzRTI8uiDZon VZkvhSaD6J7QCN28NqLZBHQtcoHW0U1B7ztsTtZUl6CApk2OxD+pYPELfmHz88qk+rpK 2DaXsaQgz8mRMTUMnNhjfrHNFu2h+HgnWP5ZHplmuwLmWN9ZumUmK+QARP38AA7mscMb FVRIYeCE+6BU5DJj74U7rPSXjqFib6XPfZxCtMGIcyehHEbbxj4iCh3GMuWe7/Pbwjjo 9xq4D/iyFxr6GIuJ/sr9iyB7pzLftCeytvV0dg26XLL9jgwlkiSoQMK/ksse2OkmbVAD Jy7g== X-Gm-Message-State: ACgBeo3YfDyZ09WP36JHTSPMS7vSocQAPylBP8ekzsyRfpjVqJoVziw2 lKHNz2sAOGjSqAeFhA7jgE2KaPE9LJWeOQ0b5HSEE2KJt3KqxX5rmRtbYMWA/kNHBw0xlDmTJDa 3gw+oHfPF3aqblUE= X-Received: by 2002:a05:620a:488e:b0:6bb:3f84:d175 with SMTP id ea14-20020a05620a488e00b006bb3f84d175mr12555297qkb.587.1661879658759; 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.0 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,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: 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