From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1888) id 1CB89381E088; Sat, 27 Aug 2022 14:16:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1CB89381E088 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1661609798; bh=exC36oanOvuPaW5pMMjzhn3Dtp/aWM7rSmbgR/2tBYA=; h=From:To:Subject:Date:From; b=OptbCBiiflSH1kxB0Zo3ZHOuSLRZeeXyzdxQDJdfFfYC/p69QJMHZVcMVFEm+9U4O 2bWg/Zpc1wMx0YCTChxcMQx05s4EcrBJxJrI8M6/HVpp2+9z59bBwkQvxez0u7upM1 /pZVP97MKW7ychfY0XW2dAhUcyJVZJ3FKe8/GJ3g= 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-2236] libstdc++: Add test for std::con/disjunction's base class X-Act-Checkin: gcc X-Git-Author: Patrick Palka X-Git-Refname: refs/heads/master X-Git-Oldrev: 4d291ca6a48eeeef3f51b8ab8452fe2166f021ee X-Git-Newrev: cace77f4fb8df18c01dfdf9040cc944eedef1147 Message-Id: <20220827141638.1CB89381E088@sourceware.org> Date: Sat, 27 Aug 2022 14:16:38 +0000 (GMT) List-Id: https://gcc.gnu.org/g:cace77f4fb8df18c01dfdf9040cc944eedef1147 commit r13-2236-gcace77f4fb8df18c01dfdf9040cc944eedef1147 Author: Patrick Palka Date: Sat Aug 27 10:15:55 2022 -0400 libstdc++: Add test for std::con/disjunction's base class libstdc++-v3/ChangeLog: * testsuite/20_util/logical_traits/requirements/base_classes.cc: New test. Diff: --- .../logical_traits/requirements/base_classes.cc | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/libstdc++-v3/testsuite/20_util/logical_traits/requirements/base_classes.cc b/libstdc++-v3/testsuite/20_util/logical_traits/requirements/base_classes.cc new file mode 100644 index 00000000000..9067a3b670e --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/logical_traits/requirements/base_classes.cc @@ -0,0 +1,34 @@ +// { dg-do compile { target c++17 } } + +#include + +template struct T : std::true_type { }; +template struct F : std::false_type { }; + +// [meta.logical]/5: The specialization conjunction has a +// public and unambiguous base that is either: +// - the first type B_i in the list true_type, B_1, ..., B_n for which +// bool(B_i::value) is false, or +// - if there is no such B_i, the last type in the list. + +static_assert(std::is_base_of_v>); +static_assert(std::is_base_of_v, std::conjunction>>); +static_assert(std::is_base_of_v, std::conjunction>>); +static_assert(std::is_base_of_v, std::conjunction, T<1>>>); +static_assert(std::is_base_of_v, std::conjunction, F<1>>>); +static_assert(std::is_base_of_v, std::conjunction, F<0>, F<1>>>); +static_assert(std::is_base_of_v, std::conjunction, F<0>, T<1>, F<1>>>); + +// [meta.logical]/10: The specialization disjunction has a +// public and unambiguous base that is either: +// - the first type B_i in the list false_type, B_1, ..., B_n for which +// bool(B_i::value) is true, or +// - if there is no such B_i, the last type in the list. + +static_assert(std::is_base_of_v>); +static_assert(std::is_base_of_v, std::disjunction>>); +static_assert(std::is_base_of_v, std::disjunction>>); +static_assert(std::is_base_of_v, std::disjunction, T<1>>>); +static_assert(std::is_base_of_v, std::disjunction, F<1>>>); +static_assert(std::is_base_of_v, std::disjunction, F<0>, F<1>>>); +static_assert(std::is_base_of_v, std::disjunction, F<0>, T<1>, F<1>>>);