From patchwork Tue Jul 25 19:55:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Polacek X-Patchwork-Id: 1812849 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=URbG+6DZ; dkim-atps=neutral Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4R9STJ6rJLz1yXx for ; Wed, 26 Jul 2023 05:56:20 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8810A385C6DF for ; Tue, 25 Jul 2023 19:56:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8810A385C6DF DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1690314978; bh=UnMmU1LBceIvZntlMizid281mqHsOu927cN1m2FKMo8=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=URbG+6DZDWCkzWJ5+RYStwmitUB/KUNTmOIawRrt+00hMTwKMMyhM8kj3XUY2hfiF IggA8bcoiN314EMZ6MNUOSHFxQV13ryQwu6kTb2WWy2UfO+ipQ/krMiWGoNcMKn0kj LBc4I9U2MwdnMmyIfVWJmZbCKI8rtHKDgSzwfdj0= 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 399C53858C3A for ; Tue, 25 Jul 2023 19:55:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 399C53858C3A Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-465-yGYzIUCRPP-NVyGr5Pnc3g-1; Tue, 25 Jul 2023 15:55:56 -0400 X-MC-Unique: yGYzIUCRPP-NVyGr5Pnc3g-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3C0008022EF for ; Tue, 25 Jul 2023 19:55:56 +0000 (UTC) Received: from pdp-11.lan (unknown [10.22.8.212]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1E23A1121330; Tue, 25 Jul 2023 19:55:56 +0000 (UTC) To: GCC Patches , Jason Merrill Subject: [PATCH] c++: clear tf_partial et al in instantiate_template [PR108960] Date: Tue, 25 Jul 2023 15:55:52 -0400 Message-ID: <20230725195552.1249139-1-polacek@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, 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 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+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk? -- >8 -- In we concluded that we might clear all flags except tf_warning_or_error when performing instantiate_template. PR c++/108960 gcc/cp/ChangeLog: * pt.cc (lookup_and_finish_template_variable): Don't clear tf_partial here. (instantiate_template): Reset all complain flags except tf_warning_or_error. --- gcc/cp/pt.cc | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) base-commit: 6e424febfbcb27c21a7fe3a137e614765f9cf9d2 diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc index 21b08a6266a..265e2a59a52 100644 --- a/gcc/cp/pt.cc +++ b/gcc/cp/pt.cc @@ -10396,12 +10396,6 @@ lookup_and_finish_template_variable (tree templ, tree targs, tree var = lookup_template_variable (templ, targs, complain); if (var == error_mark_node) return error_mark_node; - /* We may be called while doing a partial substitution, but the - type of the variable template may be auto, in which case we - will call do_auto_deduction in mark_used (which clears tf_partial) - and the auto must be properly reduced at that time for the - deduction to work. */ - complain &= ~tf_partial; var = finish_template_variable (var, complain); mark_used (var); return var; @@ -22008,6 +22002,14 @@ instantiate_template (tree tmpl, tree orig_args, tsubst_flags_t complain) if (tmpl == error_mark_node) return error_mark_node; + /* The other flags are not relevant anymore here, especially tf_partial + shouldn't be set. For instance, we may be called while doing a partial + substitution of a template variable, but the type of the variable + template may be auto, in which case we will call do_auto_deduction + in mark_used (which clears tf_partial) and the auto must be properly + reduced at that time for the deduction to work. */ + complain &= tf_warning_or_error; + gcc_assert (TREE_CODE (tmpl) == TEMPLATE_DECL); if (modules_p ())