public inbox for libstdc++-cvs@sourceware.org help / color / mirror / Atom feed
From: Patrick Palka <ppalka@gcc.gnu.org> 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 Date: Wed, 31 Aug 2022 14:05:26 +0000 (GMT) [thread overview] Message-ID: <20220831140526.26628383FB9B@sourceware.org> (raw) https://gcc.gnu.org/g:caaf9e66c498d9d6dc8be665d820ab45afa406ae commit r13-2313-gcaaf9e66c498d9d6dc8be665d820ab45afa406ae Author: Patrick Palka <ppalka@redhat.com> 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 <type_traits> + +template<class T> struct A { using type = typename T::type; }; +using invalid = A<void>; + +// [meta.logical]/3: For a specialization conjunction<B_1, ..., B_n>, if +// there is a template type argument B_i for which bool(B_i::value) is false, +// then instantiating conjunction<B_1, ..., B_n>::value does not require the +// instantiation of B_j::value for j > i. + +static_assert(!std::conjunction_v<std::false_type, invalid>); +static_assert(!std::conjunction_v<std::false_type, invalid, invalid>); +static_assert(!std::conjunction_v<std::true_type, std::false_type, invalid>); +static_assert(!std::conjunction_v<std::true_type, std::false_type, invalid, invalid>); + +// [meta.logical]/8: For a specialization disjunction<B_1, ..., B_n>, if +// there is a template type argument B_i for which bool(B_i::value) is true, +// then instantiating disjunction<B_1, ..., B_n>::value does not require the +// instantiation of B_j::value for j > i. + +static_assert(std::disjunction_v<std::true_type, invalid>); +static_assert(std::disjunction_v<std::true_type, invalid, invalid>); +static_assert(std::disjunction_v<std::false_type, std::true_type, invalid>); +static_assert(std::disjunction_v<std::false_type, std::true_type, invalid, invalid>);
reply other threads:[~2022-08-31 14:05 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220831140526.26628383FB9B@sourceware.org \ --to=ppalka@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ --cc=libstdc++-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).