This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [C++ PATCH] c++/78701 ICE in default arg unification
- From: Jason Merrill <jason at redhat dot com>
- To: Nathan Sidwell <nathan at acm dot org>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 14 Dec 2016 11:33:14 -0500
- Subject: Re: [C++ PATCH] c++/78701 ICE in default arg unification
- Authentication-results: sourceware.org; auth=none
- References: <e828be51-61b5-8eb5-ba47-269e64bfadcf@acm.org>
OK.
On Wed, Dec 14, 2016 at 9:05 AM, Nathan Sidwell <nathan@acm.org> wrote:
> This patch fixes 78701. The problematic case with a non-type template arg
> whose default value is dependent on a previous non-type arg that failed to
> be deduced on the first iteration of the loop in type_unification_real.
>
> Just before the tsubst_template_arg we've already done:
>
> if (TREE_CODE (parm) == PARM_DECL
> && uses_template_parms (TREE_TYPE (parm))
> && saw_undeduced < 2)
> continue;
>
> to check the type of the arg is deduced. This patch adds the equivalent
> check just after tsubsting, to see if we managed to get all the template
> parms replaced. I wasn't sure if it should check for PARM_DECL, perhaps
> convert_template_argument can cope with the case of a non-subst template
> parm, so checking would save a call to uses_template_parms in the type-parm
> case?
>
> Unfortunately because at this point we've pushed some state, we can't simply
> 'continue'. Hence I chose to set arg to NULL and check it later.
>
> The deleted continue is the last statement of the loop, hence deleted.
>
> ok?
>
> nathan
> --
> Nathan Sidwell