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.129.124]) by sourceware.org (Postfix) with ESMTPS id 3C89A3858283 for ; Fri, 26 Aug 2022 01:04:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3C89A3858283 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=1661475884; 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=lZeWjtF1TsZQ9MoHwe3LLv5kHHFHRPhLl+7IQvnvYBE=; b=TZMAXNtyv06rgKc7N53SH2cLRkGoHMiBQcNLo+hZiwZt/b5l2cIHGWQuwOsex2fPol4eu6 XL6b0RzgO6c8/1mEwXrsJRZjORw0UxvJFPYeRauCJzjLeNBtlThaWXfZHevaiMixG9VP4b CoVgGS6YOReuL9BXMBeWHVH6VBKXHFw= Received: from mail-qt1-f199.google.com (mail-qt1-f199.google.com [209.85.160.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-301-SHoXVqJCOlO_MN00xSiCPw-1; Thu, 25 Aug 2022 21:04:43 -0400 X-MC-Unique: SHoXVqJCOlO_MN00xSiCPw-1 Received: by mail-qt1-f199.google.com with SMTP id cm10-20020a05622a250a00b003437b745ccdso241187qtb.18 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=Tfh7xx70eAfTylG2qlc6cKnodmKCZ5nC+yrN4F9psEOLL0BC06hot5NvDYlz4s0E/3 KjnRWwML6dFKK3TICSwKMRS0ld1qiWJV9XA+nzhDfPUPCthfJQVdhXrQHLhsFXl+loZ5 fkmjZaG/hFGgdfv7VPFkfFLyf59ec/ZdRLFRfFQllbGrwGFZmglvVH/nCg6DZ6pFraOf zfiwpB+P3qxkxAK/ZyaoeCHtMm9IdbBZJxI8sAf4t5oEB4xYlvShnsBTVfVRq+h2xz47 YWpmMDpHxLmieM3riDnPUnWmfOqfITzhQVm+b46SCYywkjigkCZt0ffBLj86zqyqX5tK r26Q== X-Gm-Message-State: ACgBeo3RFWTERi8q8tLTgNB2cG4IEwwdnwzV5YhnOHOCw+eK+j1NG+zn DlP3roGw4bdXspWW4jsEJwMqw5GVJ+MRYXiKqO7KdBcyTNEoRaVWdDZv8x+Z2eSqmLudeCsHjJU sZv7F24wi1bkBMJ4= X-Received: by 2002:ae9:e104:0:b0:6bb:fb42:1e93 with SMTP id g4-20020ae9e104000000b006bbfb421e93mr5071236qkm.693.1661475882998; Thu, 25 Aug 2022 18:04:42 -0700 (PDT) X-Google-Smtp-Source: AA6agR51WNbX+C+Gfs7ieo9cqoxJgyoxKj+veHHjSUFt+/rWwkm0Ua7qEHOslzTn5+v4l7kFUuHnhg== 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) 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 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 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true 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 List-Id: 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>>>); -- 2.37.2.382.g795ea8776b