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 02D9F3858C36 for ; Tue, 26 Mar 2024 14:24:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 02D9F3858C36 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 02D9F3858C36 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711463062; cv=none; b=a16KHayQUIpSOWkpwi++4Wi9IUeER+UPl+b47HjU9I3+RAoGFdsMAQxfvJ3QwCTxrHwkH43e+Mcjik/tV7Hof82wWd1smm1DDZXYpP/pyNRDxAbmzfo0l8Ig9Nov4664kX6iV4DOvB+9Q/IErnn7sLZZnrsnRV8GHpigHRUrGx0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711463062; c=relaxed/simple; bh=hsaik30pSyytDmhopdp9xEQgt048DXe/PV6Eoi2VcU0=; h=DKIM-Signature:From:Date:To:Subject:Message-ID:MIME-Version; b=FuOftTbP4i2aRVTHGn6j2cOI1AsPTGmcYuF9YuXn80bZdKOEhRXfnvUyYIDCIf4WPR8XsZW88MW9U/XDTBQvpeQDKIonefomWW3gGXOh9NkChcVcakj2zriQ91ByrsuXMBmldPc41HfnN/hsraJAy+QpMJmTEXPAW+4MiGfig34= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1711463060; 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: in-reply-to:in-reply-to:references:references; bh=KYksEGfbFowDHObvxXNMWpMXHZP10mSax9ZU9+gaaoc=; b=AjRgEQIiokhvrhVuJVKPCdE17FUFgMBOfhHswgLn0Be/2y4wsMvq/dqGPDJ/JFmlgEnKhM 6ZesYysEp2fMdkLYx3Pd1jdCJ1RGL26okEcToRaKIWtWpLNn2ozFGXT6lFt7qZv2I1U261 u2dWsqB/Df9DPfcPSx31mX7Vt/Z821k= Received: from mail-qv1-f71.google.com (mail-qv1-f71.google.com [209.85.219.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-219-Lf6n2MRrMTe4DPYGU0fx6g-1; Tue, 26 Mar 2024 10:24:17 -0400 X-MC-Unique: Lf6n2MRrMTe4DPYGU0fx6g-1 Received: by mail-qv1-f71.google.com with SMTP id 6a1803df08f44-69181af8ceaso100836646d6.2 for ; Tue, 26 Mar 2024 07:24:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711463057; x=1712067857; h=mime-version:references:message-id:in-reply-to:subject:cc:to:date :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=KYksEGfbFowDHObvxXNMWpMXHZP10mSax9ZU9+gaaoc=; b=nc3WdZVoI/bsBK3cHKG2nSyB+pQdDMBoRLeJoCQ1MdKirB+NuR6gP4a58aEsch9DfU 6U/hTzh+Rbt/MPm9hgK81uChbMrCfze9EQIc4BkhUwb0rJzTKchy64KhiYw3zjW0mSRf Z4jEZCvBYi1CD48YrFQ8Nmerwmh1uDQGGSsD972tolthkSH+c6aDT8q7Hld0iYiIEuhK TcsN+QcGKY21QWNVf/LFt8SHH2cuexXn9l8nSgXHvFl9TJMbR4HBBtHkOXhkQLkDPZCY IpkK3TPiAM6fLBLAeYQhjI0SWpgAutT3gqahIi0/yQO9H/5bBwoBUCw9aH7XVWbiEJyJ I3JQ== X-Gm-Message-State: AOJu0YzHhY51ngXwN8gqk5yX1i3JMaW6O3Wz4awKANsOgDOHqX/+T76C F6CA41a7Rc/124AtF62iimzwkuRCGkrXbOdV49Pg4qIf5qPAni3fkxuEnMm9jXCQokfvqwUBfbJ vntJpgVXegXleS8P4wN+lMF0XmNlSwIS24ajgrhSDPI4aG/ud8zFEmx4= X-Received: by 2002:a05:6214:2585:b0:691:4bdc:aa48 with SMTP id fq5-20020a056214258500b006914bdcaa48mr3414376qvb.54.1711463057154; Tue, 26 Mar 2024 07:24:17 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGSrBSqWD6DQ1wuqHVOf5jhGjZ9Zspj+aBaQqRdJQbxSZcOgrLzGpp/jC+KI4SbiFWwXguCRw== X-Received: by 2002:a05:6214:2585:b0:691:4bdc:aa48 with SMTP id fq5-20020a056214258500b006914bdcaa48mr3414358qvb.54.1711463056833; Tue, 26 Mar 2024 07:24:16 -0700 (PDT) Received: from [192.168.1.130] (ool-457670bb.dyn.optonline.net. [69.118.112.187]) by smtp.gmail.com with ESMTPSA id x11-20020ad4458b000000b00696a47179a1sm272912qvu.14.2024.03.26.07.24.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Mar 2024 07:24:16 -0700 (PDT) From: Patrick Palka X-Google-Original-From: Patrick Palka Date: Tue, 26 Mar 2024 10:24:15 -0400 (EDT) To: Patrick Palka cc: gcc-patches@gcc.gnu.org, jason@redhat.com Subject: Re: [PATCH] c++: recalculating local specs via build_extra_args [PR114303] In-Reply-To: <20240311165307.3930810-1-ppalka@redhat.com> Message-ID: <6ee19443-b37e-8553-bd41-d5ab6e5923e2@idea> References: <20240311165307.3930810-1-ppalka@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-13.0 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_H4,RCVD_IN_MSPIKE_WL,RCVD_IN_SORBS_WEB,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: On Mon, 11 Mar 2024, Patrick Palka wrote: > Bootstrapped and regtested on x86_64-pc-linux-gnu, does this look > OK for trunk and release branches? Ping. > > -- >8 -- > > r13-6452-g341e6cd8d603a3 made build_extra_args walk evaluated contexts > first so that we prefer processing a local specialization in an evaluated > context even if its first use is in an unevaluated context. But this > means we need to avoid walking a tree that already has extra args/specs > saved because the list of saved specs appears to be an evaluated > context. It seems then that we should be calculating the saved specs > from scratch each time, rather than potentially walking the saved specs > list from an earlier partial instantiation when calling build_extra_args > a second time around. > > PR c++/114303 > > gcc/cp/ChangeLog: > > * constraint.cc (tsubst_requires_expr): Clear > REQUIRES_EXPR_EXTRA_ARGS before calling build_extra_args. > * pt.cc (tsubst_stmt) : Call build_extra_args > on the new IF_STMT instead of t which might already have > IF_STMT_EXTRA_ARGS. > > gcc/testsuite/ChangeLog: > > * g++.dg/cpp1z/constexpr-if-lambda6.C: New test. > --- > gcc/cp/constraint.cc | 1 + > gcc/cp/pt.cc | 2 +- > .../g++.dg/cpp1z/constexpr-if-lambda6.C | 16 ++++++++++++++++ > 3 files changed, 18 insertions(+), 1 deletion(-) > create mode 100644 gcc/testsuite/g++.dg/cpp1z/constexpr-if-lambda6.C > > diff --git a/gcc/cp/constraint.cc b/gcc/cp/constraint.cc > index 49de3211d4c..8a3b5d80ba7 100644 > --- a/gcc/cp/constraint.cc > +++ b/gcc/cp/constraint.cc > @@ -2362,6 +2362,7 @@ tsubst_requires_expr (tree t, tree args, sat_info info) > matching or dguide constraint rewriting), in which case we need > to partially substitute. */ > t = copy_node (t); > + REQUIRES_EXPR_EXTRA_ARGS (t) = NULL_TREE; > REQUIRES_EXPR_EXTRA_ARGS (t) = build_extra_args (t, args, info.complain); > return t; > } > diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc > index 8cf0d5b7a8d..37f2392d035 100644 > --- a/gcc/cp/pt.cc > +++ b/gcc/cp/pt.cc > @@ -18718,7 +18718,7 @@ tsubst_stmt (tree t, tree args, tsubst_flags_t complain, tree in_decl) > IF_COND (stmt) = IF_COND (t); > THEN_CLAUSE (stmt) = THEN_CLAUSE (t); > ELSE_CLAUSE (stmt) = ELSE_CLAUSE (t); > - IF_STMT_EXTRA_ARGS (stmt) = build_extra_args (t, args, complain); > + IF_STMT_EXTRA_ARGS (stmt) = build_extra_args (stmt, args, complain); > add_stmt (stmt); > break; > } > diff --git a/gcc/testsuite/g++.dg/cpp1z/constexpr-if-lambda6.C b/gcc/testsuite/g++.dg/cpp1z/constexpr-if-lambda6.C > new file mode 100644 > index 00000000000..038c2a41210 > --- /dev/null > +++ b/gcc/testsuite/g++.dg/cpp1z/constexpr-if-lambda6.C > @@ -0,0 +1,16 @@ > +// PR c++/114303 > +// { dg-do compile { target c++17 } } > + > +struct A { static constexpr bool value = true; }; > + > +int main() { > + [](auto x1) { > + return [&](auto) { > + return [&](auto x3) { > + if constexpr (decltype(x3)::value) { > + static_assert(decltype(x1)::value); > + } > + }(A{}); > + }(0); > + }(A{}); > +} > -- > 2.44.0.165.ge09f1254c5 > >