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 399C53858C3A for ; Tue, 25 Jul 2023 19:55:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 399C53858C3A 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=1690314957; 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=UnMmU1LBceIvZntlMizid281mqHsOu927cN1m2FKMo8=; b=YHMLAJqlOPEvnQUnqetARTW/FD94R2w003xzO+6jlvRv7DDQ5YgMNTR7xwoBmQmj1JTvqT BAmHcH9q87KgJk88a8sbLVQl1oEglsC5jjnMJm2pSuP3vNc18FwJk0cxIDiG5PiKyt5fJG aZ0GSD2TYb4mhR6whohXZf5ZCrK4A9Y= 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) From: Marek Polacek 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 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true 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 List-Id: 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(-) 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 ()) base-commit: 6e424febfbcb27c21a7fe3a137e614765f9cf9d2 -- 2.41.0