From patchwork Fri Aug 26 01:04:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Palka X-Patchwork-Id: 773 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:ecc5:0:0:0:0:0 with SMTP id s5csp25141wro; Thu, 25 Aug 2022 18:05:32 -0700 (PDT) X-Google-Smtp-Source: AA6agR4w5HOZZ+90hW/0sRsGxk++GC5oj0nBbiQ2n0dWmcK/IpYo/RUy5zUQ9eXTjffUihUnZDGd X-Received: by 2002:a17:906:7304:b0:730:c3a8:cd7a with SMTP id di4-20020a170906730400b00730c3a8cd7amr3817466ejc.575.1661475931076; Thu, 25 Aug 2022 18:05:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661475931; cv=none; d=google.com; s=arc-20160816; b=csM6x0cT8W09/3GEvYDsmqAhqRhzbQZT/SaWp1yIdxGCBk348S0gnbNrq0XsUr2zFX /FRRo6/T8GrViEyMrBrWlPDe09o4LnnsTHZV31nS6dfbd40/eUo/K1TeoNBEa/X5xIcA e82LpW8kBnTuNJvZBpa4eq6iieDsLD74c0tqukjFfOVnAU3pGhRygx3TJd+vP5jkxf95 tVIzw9xnxN0MVcNfv7RyGF0HC62G6O0Nn0hERf6zZleHo/NG2yj4FkYDJCPkHP28cjKn LkY4yFCsu/qBBL7hglzkE8vy71P7i0kkdKktSWwO8+0If/qFtwHR8iD5IVZG4/TY8h8w 8W6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:reply-to:from:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:to :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=lZeWjtF1TsZQ9MoHwe3LLv5kHHFHRPhLl+7IQvnvYBE=; b=FcLE5ucHmgrCi0k4tNiOsqfEITKEF774h7qcHL+LwGvkENp/6EWmI4AaRpweW6yO9G ZLnqUBi/VxzKRynV5mXyAjxuCkgMMVg1pK6MrtnjG76cp2H9fi4/UA/h1azTB+YU/6qc O5Dnc/43F+wHC0+DuAylWGHdKibRXTO8ogbw7iYdr62m1x2s/3Pv6HsXYAqZ4MJtPttP 8Cx4rAD1J11G6hfo7I5r+Ikb8NIUUz8uBHlnytq1QZrJdwqPjVv4gdO2IJWWuTH0rCtY QAU0l002L71yIfVuQQJsqG0gX9d2kqivlXRDoRfMKrCu/3D0y/DQkohIDPgxloiwivKI xDBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=U10eVSIV; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id jw9-20020a17090776a900b00730672860bdsi364883ejc.123.2022.08.25.18.05.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Aug 2022 18:05:31 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=U10eVSIV; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id DBA823857B86 for ; Fri, 26 Aug 2022 01:05:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DBA823857B86 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1661475927; bh=lZeWjtF1TsZQ9MoHwe3LLv5kHHFHRPhLl+7IQvnvYBE=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=U10eVSIVZwUWnoK9G44YX67qxg58kCf509Ed3GjJZkvtHc0h9bEmEDDvdTF+gVBu4 jH138MSjWt2OeG396bbx1HE/JHaadF5GmJ5CkXHWWOxSMjlVxP5ytusiuKueF2/g4V KsaBfT2wsOLRR9l1KRhH7PBbaPVVXHs8fhcXKxJc= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org 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 3966E3858C52 for ; Fri, 26 Aug 2022 01:04:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3966E3858C52 Received: from mail-qv1-f72.google.com (mail-qv1-f72.google.com [209.85.219.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-611-xVc33CUlOGGNqvK3aO82fw-1; Thu, 25 Aug 2022 21:04:43 -0400 X-MC-Unique: xVc33CUlOGGNqvK3aO82fw-1 Received: by mail-qv1-f72.google.com with SMTP id n17-20020ad444b1000000b00496d5b41d37so10230qvt.6 for ; Thu, 25 Aug 2022 18:04:43 -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; bh=lZeWjtF1TsZQ9MoHwe3LLv5kHHFHRPhLl+7IQvnvYBE=; b=qffNUNQzYwJ099v3vkXZrv2enObpah1Atyg4jDVeivJQJj0l8FBziQKLhb3Ua6Wz3c DkhrluXFdBujLjjNP0bm2oVnyggFiK51PRnnPvPkvfv6XylXXt2jRUpu3pyoaZ5dr3Bk bq6TrVZ1IFCSTEHaPZoKA6ZgF2EK4se8l/9dQAM+4gQNt9Xk1A6ctmfse6wPjLyghbIR tBvtRy7GhpFwYacqE1Br+y3ZNZvyZdyIXwKrLftN1O2oqWi/IvenYKul2EhDgI27csm8 ED7B99BvrGYlPB/lI5FRBdWdMqEbaFbzohIQtPUd8rdv68XJdlanmipfBHqYEDIWcBZU rJAQ== X-Gm-Message-State: ACgBeo2UVECFGgwFg7W5ragivM9dFkb3yjAnpe9nfJz2dgcopnuh3RMo lNExaqAQv03ldsJeC5IjCbnd2NZ7M347wAW43tU0SZtSedQ0VV+2t5LfDYR59LZjWnrJu7S/nJB f3Pd03CsE6XE+HKKWt9u0r07+M8sJs1YGdApCtXBNcPasNLVgMLcSFy1kdnvtpfGy1A4= X-Received: by 2002:ae9:e104:0:b0:6bb:fb42:1e93 with SMTP id g4-20020ae9e104000000b006bbfb421e93mr5071242qkm.693.1661475883070; Thu, 25 Aug 2022 18:04:43 -0700 (PDT) X-Received: by 2002:ae9:e104:0:b0:6bb:fb42:1e93 with SMTP id g4-20020ae9e104000000b006bbfb421e93mr5071223qkm.693.1661475882762; Thu, 25 Aug 2022 18:04:42 -0700 (PDT) Received: from localhost.localdomain (ool-457670bb.dyn.optonline.net. [69.118.112.187]) by smtp.gmail.com with ESMTPSA id h8-20020ac85488000000b0034308283775sm331860qtq.21.2022.08.25.18.04.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Aug 2022 18:04:42 -0700 (PDT) To: gcc-patches@gcc.gnu.org Subject: [PATCH] libstdc++: Add test for std::con/disjunction's base class Date: Thu, 25 Aug 2022 21:04:28 -0400 Message-Id: <20220826010428.2272001-1-ppalka@redhat.com> X-Mailer: git-send-email 2.37.2.382.g795ea8776b MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-14.3 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=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Patrick Palka via Gcc-patches From: Patrick Palka Reply-To: Patrick Palka Cc: libstdc++@gcc.gnu.org Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1742183785859935090?= X-GMAIL-MSGID: =?utf-8?q?1742183785859935090?= Tested on x86_64-pc-linux-gnu, does this look OK for trunk? libstdc++-v3/ChangeLog: * testsuite/20_util/logical_traits/requirements/base_classes.cc: New test. --- .../requirements/base_classes.cc | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 libstdc++-v3/testsuite/20_util/logical_traits/requirements/base_classes.cc 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..6699037bb14 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/logical_traits/requirements/base_classes.cc @@ -0,0 +1,37 @@ +// { dg-do compile { target c++17 } } + +#include + +using std::true_type; +using std::false_type; + +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 Bi, 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 Bi, 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>>>);