public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jason Merrill <jason@redhat.com>
To: gcc-patches@gcc.gnu.org
Subject: [pushed] c++: tweak deduction with auto template parms
Date: Wed, 22 Jun 2022 23:22:51 -0400	[thread overview]
Message-ID: <20220623032251.49288-1-jason@redhat.com> (raw)
In-Reply-To: <20220623032123.48962-1-jason@redhat.com>

While looking at PR105964 I noticed that we were unnecessarily repeating
the deduction loop because of seeing a non-type parameter with type 'auto'.
It is indeed dependent, but not on any other deductions.

Tested x86_64-pc-linux-gnu, applying to trunk.

gcc/cp/ChangeLog:

	* pt.cc (type_unification_real): An auto tparm can't
	be affected by other deductions.
---
 gcc/cp/pt.cc | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc
index 4d1c325432d..80d2bec2348 100644
--- a/gcc/cp/pt.cc
+++ b/gcc/cp/pt.cc
@@ -22982,6 +22982,7 @@ type_unification_real (tree tparms,
 	     deduced from a later argument than the one from which
 	     this parameter can be deduced.  */
 	  if (TREE_CODE (tparm) == PARM_DECL
+	      && !is_auto (TREE_TYPE (tparm))
 	      && uses_template_parms (TREE_TYPE (tparm))
 	      && saw_undeduced < 2)
 	    {
@@ -23042,6 +23043,7 @@ type_unification_real (tree tparms,
 
 	  if (saw_undeduced == 1
 	      && TREE_CODE (parm) == PARM_DECL
+	      && !is_auto (TREE_TYPE (parm))
 	      && uses_template_parms (TREE_TYPE (parm)))
 	    {
 	      /* The type of this non-type parameter depends on undeduced

base-commit: 349a39f061407ce2339d2ba25da97005f2030c88
prerequisite-patch-id: d5622f522428b601200c8c234ddb5e58c91dcb06
-- 
2.27.0


      reply	other threads:[~2022-06-23  3:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-23  3:21 [pushed] c++: dependence of baselink [PR105964] Jason Merrill
2022-06-23  3:22 ` Jason Merrill [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220623032251.49288-1-jason@redhat.com \
    --to=jason@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).