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 1E3123858D20 for ; Fri, 3 Feb 2023 18:51:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1E3123858D20 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=1675450269; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=MLL9g1rFBNl83nodjm/rjHxyWIpYLPgsoCdB6zqdxx0=; b=I4VIKRV3xxGk7cPkR3cPH8R8ujEKEKXURsGvvuZEfuVBy/N7iJlpwGALN/j8CDwIzlyiwW IIlnw2BLrFFBG7/YuLmiEuEnuoxsL4V54TB0qkwcBTTDBmw/gOqLbasYLgHAghkpOkJYRu xspMTfH9/yI9Hn06RddDsMJ24bFAxJg= 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) From: Marek Polacek 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 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true 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 List-Id: 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 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() {} base-commit: f0065f207cf19cd960b33d961472c6d69514336f -- 2.39.1