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 E51A9385771A for ; Wed, 3 May 2023 19:37:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E51A9385771A 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=1683142678; 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: in-reply-to:in-reply-to:references:references; bh=LmSF9H6/oJ1LpjvqXydB8Js15ZnU+SgzqPLs7Iji4H4=; b=BI10bj1NzJ8DBsTl+txjzwhbhvyEdwAhF5eEQ2/SIY7Im2FehGxgpz/aocAWhx2yRae+Bb Dwz8x/h1gvzpQ7Vah6myoe+O+scHBLNSzeS2dxJItjt7dlfVhL8q2eNjU4IZmgVNlQWlkT Z0jLKwMsiRhDmUlWiUr8lyzPig+TVz4= Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-519-9H8NzmdyM8uiWBSq2ypGMg-1; Wed, 03 May 2023 15:37:56 -0400 X-MC-Unique: 9H8NzmdyM8uiWBSq2ypGMg-1 Received: by mail-qk1-f200.google.com with SMTP id af79cd13be357-75167807f44so257455585a.1 for ; Wed, 03 May 2023 12:37:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683142676; x=1685734676; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=LmSF9H6/oJ1LpjvqXydB8Js15ZnU+SgzqPLs7Iji4H4=; b=BzRfMtkdKusBCnVTtjfibPJ5ANmHqZ+NV1VkLlFOOuIwhI2C4e+DnnCauqRWiS2EfA wFEfKX3XwDsnktThfQ70nQaQFJ3d/Eem2ZfUrLM0ZWuQFCv2nNWEilSvBYtc1xhJb0Yp Ps9qy/k+agE0S98wSc6vYKSEPCZ0svmWGDysToPryd70M7akTDecSLH//8DuDdj8mtjg 5TcXX9O2Xr3D7RBQ+6NTLgFQfSgecQFaGaEVV74AKb9I+AazBx0R16asnxrWdCLMU+Bh ngz77lX7bTqY6nDYCbQUF5g8jwD7Xaz31AzPVrx0UeY8jXJdcEo4s3VeleLkplgELJ+v uIoQ== X-Gm-Message-State: AC+VfDyn8A+YGMurB+p5YYFlZiYT712QMO2y6l3wxrxbyp3cbop5/5zm mu6zndoPOeBkE9ldYTy920MBERqjw6er6006W9Fb5OmANCWWQaozvFwXxR44eqzDjfoGzCW+tDP Eai1uRiMj5hmj4SfOqA== X-Received: by 2002:a05:622a:1308:b0:3e6:47f8:3f0c with SMTP id v8-20020a05622a130800b003e647f83f0cmr1741063qtk.58.1683142676344; Wed, 03 May 2023 12:37:56 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ67lXp3R3BlI1oXSHe2knmhMjoxxifOO2985p/RgKgcg4ovLKat9OooiXh6WFtHyhJs/NT5YA== X-Received: by 2002:a05:622a:1308:b0:3e6:47f8:3f0c with SMTP id v8-20020a05622a130800b003e647f83f0cmr1741041qtk.58.1683142676054; Wed, 03 May 2023 12:37:56 -0700 (PDT) Received: from [192.168.1.108] (130-44-146-16.s12558.c3-0.arl-cbr1.sbo-arl.ma.cable.rcncustomer.com. [130.44.146.16]) by smtp.gmail.com with ESMTPSA id az8-20020a05620a170800b0074e4c3719e9sm9082775qkb.69.2023.05.03.12.37.55 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 03 May 2023 12:37:55 -0700 (PDT) Message-ID: Date: Wed, 3 May 2023 15:37:53 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.1 Subject: Re: [PATCH] c++: satisfaction of non-dep member alias template-id To: Patrick Palka , gcc-patches@gcc.gnu.org References: <20230502211310.220156-1-ppalka@redhat.com> From: Jason Merrill In-Reply-To: <20230502211310.220156-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=-15.0 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_NONE,RCVD_IN_MSPIKE_H2,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: On 5/2/23 17:13, Patrick Palka wrote: > constraints_satisfied_p already carefully checks dependence of template > arguments before proceeding with satisfaction, so the dependence check > in instantiate_alias_template is unnecessary and overly conservative. > Getting rid of it allows us to check satisfaction ahead of time in more > cases as in the below testcase. > > Bootstrapped and regtested on x86_64-pc-linux-gnu, does this look OK for > trunk? OK. > gcc/cp/ChangeLog: > > * pt.cc (instantiate_alias_template): Exit early upon > error from coerce_template_parms. Remove dependence test > guarding constraints_satisfied_p. > > gcc/testsuite/ChangeLog: > > * g++.dg/cpp2a/concepts-alias6.C: New test. > --- > gcc/cp/pt.cc | 6 +++--- > gcc/testsuite/g++.dg/cpp2a/concepts-alias6.C | 15 +++++++++++++++ > 2 files changed, 18 insertions(+), 3 deletions(-) > create mode 100644 gcc/testsuite/g++.dg/cpp2a/concepts-alias6.C > > diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc > index 3f1cf139bbd..930291917f2 100644 > --- a/gcc/cp/pt.cc > +++ b/gcc/cp/pt.cc > @@ -22178,11 +22178,11 @@ instantiate_alias_template (tree tmpl, tree args, tsubst_flags_t complain) > > args = coerce_template_parms (DECL_TEMPLATE_PARMS (tmpl), > args, tmpl, complain); > + if (args == error_mark_node) > + return args; > > /* FIXME check for satisfaction in check_instantiated_args. */ > - if (flag_concepts > - && !any_dependent_template_arguments_p (args) > - && !constraints_satisfied_p (tmpl, args)) > + if (!constraints_satisfied_p (tmpl, args)) > { > if (complain & tf_error) > { > diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-alias6.C b/gcc/testsuite/g++.dg/cpp2a/concepts-alias6.C > new file mode 100644 > index 00000000000..4acd57d36e6 > --- /dev/null > +++ b/gcc/testsuite/g++.dg/cpp2a/concepts-alias6.C > @@ -0,0 +1,15 @@ > +// Verify we can check satisfaction of non-dependent member alias > +// template-ids whose constraints don't depend on outer template > +// arguments ahead of time. > +// { dg-do compile { target c++20 } } > + > +template > +struct A { > + template requires (N > 0) > + using at = T; > + > + void f() { > + using ty1 = at<0>; // { dg-error "constraint" } > + using ty2 = at<1>; > + } > +};