From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1888) id 26628383FB9B; Wed, 31 Aug 2022 14:05:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 26628383FB9B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1661954726; bh=zdJB2zcN3I3FuqoQ7xA8R4U3SHTGdz0UFggL2/auhvE=; h=From:To:Subject:Date:From; b=Y6b8QOuIWn0qiD3dYddd2zlLbtia6eIRK3rjs/FfeVn1IBXlA4J/dgCaFsd+KXcZi xWQf2carRrV2dl6xRtR5K9M+LHcIq7LTNpY3XFxZ8wwTOndsQ+XSES50rsPa9pQySK 5uw0YZa2IFVs8lMVa51N65csj4IELFXroVP+Y6ok= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Patrick Palka To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r13-2313] libstdc++: Add test for std::con/disjunction's short circuiting X-Act-Checkin: gcc X-Git-Author: Patrick Palka X-Git-Refname: refs/heads/master X-Git-Oldrev: e47df5eb56c4e7aca0d3e50826e5aaa1887fa446 X-Git-Newrev: caaf9e66c498d9d6dc8be665d820ab45afa406ae Message-Id: <20220831140526.26628383FB9B@sourceware.org> Date: Wed, 31 Aug 2022 14:05:26 +0000 (GMT) List-Id: https://gcc.gnu.org/g:caaf9e66c498d9d6dc8be665d820ab45afa406ae commit r13-2313-gcaaf9e66c498d9d6dc8be665d820ab45afa406ae Author: Patrick Palka Date: Wed Aug 31 10:04:54 2022 -0400 libstdc++: Add test for std::con/disjunction's short circuiting libstdc++-v3/ChangeLog: * testsuite/20_util/logical_traits/requirements/short_circuit.cc: New test. Diff: --- .../logical_traits/requirements/short_circuit.cc | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) 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..86996b27fa5 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/logical_traits/requirements/short_circuit.cc @@ -0,0 +1,26 @@ +// { 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); + +// [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);