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.133.124]) by sourceware.org (Postfix) with ESMTP id E095B3858435 for ; Tue, 28 Sep 2021 19:42:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E095B3858435 Received: from mail-qv1-f70.google.com (mail-qv1-f70.google.com [209.85.219.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-482-ryvR93FxPw6-Gay8byh2Bg-1; Tue, 28 Sep 2021 15:42:22 -0400 X-MC-Unique: ryvR93FxPw6-Gay8byh2Bg-1 Received: by mail-qv1-f70.google.com with SMTP id ez4-20020ad45904000000b0038277ac82beso117307qvb.4 for ; Tue, 28 Sep 2021 12:42:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:references:from:in-reply-to :content-transfer-encoding; bh=oSALH5i+P6F2yjuFrVU2GwG7QtAISyLQjp3PvEM4gxE=; b=hWPJaQTjEtw4puqpkXgUBqfyv2Gxbx9dCm0slJgRoA3zB43tR2f9g8X54oIbNrJcpz 9QcGi/Uch+nAvg7VVdnf5Lg6/vzYhNuR5rvt3grBzFG8Cx+RDFLVWg0Ha0Okwy3pSjZy Cxd7/XUMP+GbleRuYWf+CkRgWl49PTZBBgzXS1tRE2XAJpfBlEaMaa69J0cxHBVJLWDD COFJc+QJFnoUHR57f+dn8K0ECqTnvV6xffBE/ob0+NtlHOX771duDCppScZjPVzPHfU8 dRD/3Ol8UIV/sZJ8RyOdNWGsab+MpdHiOVFcv0syQqOkr64A9xiv/DNm9Fz6e0To6HVN hyuQ== X-Gm-Message-State: AOAM531KasV0Qnl1scSAAbt5HCimLIXq5Gpg2uemW6Ub5OAb6oqb2HIb 1R2L5BksirSB4T8aeflbm7gXzH+pDLC6W+ZUCOi7Gl6sq07qNSAzaFO6S6tj/o//8fRDikg0uS/ l9iFmUaEiphJTaGzwVA== X-Received: by 2002:ae9:d607:: with SMTP id r7mr1808827qkk.142.1632858141947; Tue, 28 Sep 2021 12:42:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwzNEtQQJUKpzEWcQq7sUDHyEq8FLjZmL87IAGPRhRZDdpg9dY5kMW6ZnONYLHSWA2AZA0wEg== X-Received: by 2002:ae9:d607:: with SMTP id r7mr1808807qkk.142.1632858141695; Tue, 28 Sep 2021 12:42:21 -0700 (PDT) Received: from [192.168.1.149] (130-44-159-43.s15913.c3-0.arl-cbr1.sbo-arl.ma.cable.rcncustomer.com. [130.44.159.43]) by smtp.gmail.com with ESMTPSA id j16sm81861qko.15.2021.09.28.12.42.20 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 28 Sep 2021 12:42:21 -0700 (PDT) Message-ID: <53c7e21a-8c03-2411-e36a-bd8df1bd60c4@redhat.com> Date: Tue, 28 Sep 2021 15:42:20 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.1.1 Subject: Re: [PATCH] c++: ttp matching with constrained auto parm [PR99909] To: Patrick Palka , gcc-patches@gcc.gnu.org References: <20210928191541.3143405-1-ppalka@redhat.com> From: Jason Merrill In-Reply-To: <20210928191541.3143405-1-ppalka@redhat.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-14.1 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, NICE_REPLY_A, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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-List-Received-Date: Tue, 28 Sep 2021 19:42:25 -0000 On 9/28/21 15:15, Patrick Palka wrote: > Here, when unifying TT with S, processing_template_decl is unset, and > this foils the dependence checks in do_auto_deduction for avoiding > checking constraints on an auto when the initializer is dependent. > > This patch fixes this issue by making sure processing_template_decl is > set during the call to unify from coerce_template_template_parms; this > seems sensible because we're unifying one set of template parameters > with another, so we're dealing with templated trees throughout. > Bootstrapped and regtested on x86_64-pc-linux-gnu, does this look OK for > trunk? OK. > PR c++/99909 > > gcc/cp/ChangeLog: > > * pt.c (coerce_template_template_parms): Keep > processing_template_decl set during the call to unify as well. > > gcc/testsuite/ChangeLog: > > * g++.dg/cpp2a/concepts-ttp3.C: New test. > --- > gcc/cp/pt.c | 4 ++-- > gcc/testsuite/g++.dg/cpp2a/concepts-ttp3.C | 11 +++++++++++ > 2 files changed, 13 insertions(+), 2 deletions(-) > create mode 100644 gcc/testsuite/g++.dg/cpp2a/concepts-ttp3.C > > diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c > index 41fa7ed5e43..1dcdffe322a 100644 > --- a/gcc/cp/pt.c > +++ b/gcc/cp/pt.c > @@ -7994,12 +7994,12 @@ coerce_template_template_parms (tree parm_parms, > /* So coerce P's args to apply to A's parms, and then deduce between A's > args and the converted args. If that succeeds, A is at least as > specialized as P, so they match.*/ > + processing_template_decl_sentinel ptds (/*reset*/false); > + ++processing_template_decl; > tree pargs = template_parms_level_to_args (parm_parms); > pargs = add_outermost_template_args (outer_args, pargs); > - ++processing_template_decl; > pargs = coerce_template_parms (arg_parms, pargs, NULL_TREE, tf_none, > /*require_all*/true, /*use_default*/true); > - --processing_template_decl; > if (pargs != error_mark_node) > { > tree targs = make_tree_vec (nargs); > diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-ttp3.C b/gcc/testsuite/g++.dg/cpp2a/concepts-ttp3.C > new file mode 100644 > index 00000000000..898524e0dfa > --- /dev/null > +++ b/gcc/testsuite/g++.dg/cpp2a/concepts-ttp3.C > @@ -0,0 +1,11 @@ > +// PR c++/99909 > +// { dg-do compile { target c++20 } } > + > +template constexpr bool always_true = true; > +template concept C = always_true; > + > +template struct S { }; > + > +template class TT> void f() { } > + > +template void f(); >