From patchwork Fri Feb 3 18:51:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Polacek X-Patchwork-Id: 52612 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1003551wrn; Fri, 3 Feb 2023 10:51:54 -0800 (PST) X-Google-Smtp-Source: AK7set+6ciUPKsiUGFo6UP2VVTxQMqbz13e5oqlPorvh7fG9T/XU+tH1+5nAcOncBABHUhhKmR+d X-Received: by 2002:a17:907:ca85:b0:88d:ba89:1830 with SMTP id ul5-20020a170907ca8500b0088dba891830mr6748710ejc.1.1675450314362; Fri, 03 Feb 2023 10:51:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675450314; cv=none; d=google.com; s=arc-20160816; b=PD1R24iNJIGkAmz2KUiwO2J0QBvqLA5xVB8tK9/XUd+VKff7aAd42JWyGMbwdjzQMs yoIwAh5nRgIBLgrVXLQ5jMj4/I+s1Y0a0rgT0Z0Xr+MsUfP3eEFK2f2voqkfgwh0m+6W DFS293/x1UucCbqzbP9Y70+VBhYj36bEc30we6AluiF5nxbuGgF5kDTcXFsQZr3oRFf3 jI9hqqNECFvFr9+3Vy1Q9Cj4TfCS7AaVgodyy7/6Dgi9XfPTuEfkG9zoPEktChdohD9Z y82QQbd9m5uQrJnLQfW/rNZPSDotz1ZQ+XpUDsWNkhnuylLUtHjYyOy2C93CxU9hqWGS NOzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=MLL9g1rFBNl83nodjm/rjHxyWIpYLPgsoCdB6zqdxx0=; b=gdPMDhTZiMoTswpzLvf60ZsK9iNNhvOTjVBd62M6YaD8YvGKppnD9dyLipkTzVZ/Vo D04+HFB5tkIxEFcS7J+TN0BgpU7ewihLitmlf9TfxH6K8CVN2UDf0Iv9eY0QI6ohwMvj gqtAqcCILIIC1KA7su+UsMa6tbTkd4EYqp20pa96CSUl9JoIUCO1QHPVEVm9xTzqILyC TOFEdC3OUjKpM8HUQAYVtcgY2KOJJ89Ci1wnPMhDqviEMD1qEQxGC1+FY/XIzk5+FA5d 1ESnS/yVdCJhdjyPTMwLziCokwNj6MjvI5Zu27XIamoVpnj4KHSaAgXcozGdfbFQYnmt amPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=u8Hn3d1u; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 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. [8.43.85.97]) by mx.google.com with ESMTPS id 10-20020a17090602ca00b00877e020053csi3637148ejk.740.2023.02.03.10.51.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Feb 2023 10:51:54 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=u8Hn3d1u; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 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 5D2A33858416 for ; Fri, 3 Feb 2023 18:51:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5D2A33858416 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1675450313; bh=MLL9g1rFBNl83nodjm/rjHxyWIpYLPgsoCdB6zqdxx0=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=u8Hn3d1uylOKcKRcYA2YtGentIpRvI6xONsVbmkLUhiKZ6El84HnJSDkHOxp7psS5 HxqZQynxucjJrC95yb7cQFgBzXAyQSkI4RKENlQ/ajQgMtMcXzWDiLMU+Mj9cUudBb D4kRe3LNSV19uBJb8YUDew5x1WrZmZynSyknozUw= 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 1E3123858D20 for ; Fri, 3 Feb 2023 18:51:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1E3123858D20 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-383-0F7koA82Nz6qKG-YhGEu6Q-1; Fri, 03 Feb 2023 13:51:08 -0500 X-MC-Unique: 0F7koA82Nz6qKG-YhGEu6Q-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E689838012F2 for ; Fri, 3 Feb 2023 18:51:07 +0000 (UTC) Received: from pdp-11.redhat.com (unknown [10.22.9.191]) by smtp.corp.redhat.com (Postfix) with ESMTP id CF01153AA for ; Fri, 3 Feb 2023 18:51:07 +0000 (UTC) To: GCC Patches Subject: [pushed] c++: Add fixed test [PR101071] Date: Fri, 3 Feb 2023 13:51:03 -0500 Message-Id: <20230203185103.802749-1-polacek@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.4 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_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP 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: Marek Polacek via Gcc-patches From: Marek Polacek Reply-To: Marek Polacek 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?1756836989112319281?= X-GMAIL-MSGID: =?utf-8?q?1756836989112319281?= As a happy accident, this was fixed by the recent r13-2978. PR c++/101071 gcc/testsuite/ChangeLog: * g++.dg/cpp0x/variadic-alias8.C: New test. --- gcc/testsuite/g++.dg/cpp0x/variadic-alias8.C | 95 ++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic-alias8.C base-commit: f0065f207cf19cd960b33d961472c6d69514336f diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic-alias8.C b/gcc/testsuite/g++.dg/cpp0x/variadic-alias8.C new file mode 100644 index 00000000000..1d317ef8438 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/variadic-alias8.C @@ -0,0 +1,95 @@ +// PR c++/101071 +// { dg-do compile { target c++11 } } +// { dg-additional-options "-fno-elide-constructors -O2" } + +// Like variadic-alias2.C, just different options. + +template +struct list {}; + +struct nil; + +//////////////////////////////////////////////////////////////////////////////// + +template +struct number { + constexpr /*implicit*/ operator int() const { return n; } + using type = number; +}; + +using false_ = number<0>; +using true_ = number<1>; + +static_assert(!false_{}, ""); +static_assert(true_{}, ""); + +template using numbers = list...>; + +//////////////////////////////////////////////////////////////////////////////// + +template +struct less_impl; + +template +struct less_impl, number> + : number<(lhs < rhs)> {}; + +template using less = typename less_impl::type; + +//////////////////////////////////////////////////////////////////////////////// + +template +struct sum_impl { + static_assert(sizeof...(vs) == 0, "see specialization"); + using type = v0; +}; + +template +struct sum_impl, number, vs...> + : sum_impl, vs...> {}; + +template using sum = typename sum_impl::type; + +//////////////////////////////////////////////////////////////////////////////// + +template +struct conditional_impl { + static_assert(num{}, "see specialization"); + + template + using type = T; +}; + +template<> +struct conditional_impl { + template + using type = F; +}; + +template +using conditional = typename conditional_impl::template type; + +//////////////////////////////////////////////////////////////////////////////// + +template +struct min_filter_impl; + +template +struct min_filter_impl> { + template + using count_better_mins = sum...>; + + using type = list, nil, nums>...>; +}; + +template using min_filter = typename min_filter_impl::type; + +//////////////////////////////////////////////////////////////////////////////// + +void test_min_filter() { + using computed = min_filter>; + using expected = list, nil, number<2>>; + (void)(computed{} = expected{});// compiles for identical types +} + +int main() {}