This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [C++ PATCH,committed] Fix PR17344 (missing tf_error check incoerce_template_parms)
Mark Mitchell wrote:
Why do we check if "A<void>" is valid as part of SFINAE? I think that
if we deduce X = A, whatever happens after that point is just an
ordinary error, not SFINAE.
It's during deduction of 'X'. We have an idea that 'X' could be 'A'. But
does 'X<void>' agree with 'A<int,0>'? Hence we need to check the template
arguments.
In 'coerce_template_parms', it loops through all template argument to
catch all possible error (when tf_error is set) rather than the first one.
The first argument matching fails, i.e. 'void' is not 'int'. We then check
the second argument.
For the argument 'A<int,0>', its second argument is '0'. But for the parameter
'X<void>', when 'X' is 'A' this gives 'A<void>' = 'A<void, ERROR_MARK_NODE>'.
We need to dig into default argument of 'A' and it refers to a non-existent member.
This explanation should give you a clearer idea of the process.
--Kriang