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