https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93279
--- Comment #6 from Marek Polacek <mpolacek at gcc dot gnu.org> --- This passes dg.exp but I haven't convinced it's the right solution so haven't posted it... --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -21849,8 +21849,12 @@ type_unification_real (tree tparms, NULL_TREE); if (!uses_template_parms (substed)) - arg = convert_template_argument (parm, substed, full_targs, - complain, i, NULL_TREE); + { + ++processing_template_decl; + arg = convert_template_argument (parm, substed, full_targs, + complain, i, NULL_TREE); + --processing_template_decl; + } else if (saw_undeduced == 1) arg = NULL_TREE; else