[C++ Patch] PR 34892
Paolo Carlini
paolo.carlini@oracle.com
Wed Oct 24 18:52:00 GMT 2012
Hi,
On 10/24/2012 07:30 PM, Jason Merrill wrote:
> On 10/24/2012 01:20 PM, Paolo Carlini wrote:
>> + if (parm == error_mark_node
>> + || TREE_PURPOSE (parm) == error_mark_node)
>
> It seems odd to bail out early if the default argument is bad even if
> we aren't trying to use it. Doesn't it work to check this further
> down where we actually look at the default argument?
The problem is that the first time we go through the loop, when parm_idx
== 0 and TREE_PURPOSE is error_mark_node, the condition:
if (template_parameter_pack_p (TREE_VALUE (parm))
&& !(arg && ARGUMENT_PACK_P (arg)))
near the beginning of the loop is true, thus we call
coerce_template_parameter_pack, no error and we continue to the next
iteration. The next iteration, arg == NULL_TREE and require_all_args is
true, we actually use TREE_PURPOSE (parm) but for the next parm, when
things are fine, then we get to the:
TREE_VEC_ELT (new_inner_args, arg_idx) = arg;
at the bottom of the loop and we are in big troubles because
new_inner_args has only 1 element and arg_idx is 2.
Thus, in summary, it really seems to me that we should do *something*
the *first* time through the loop, when currently we only use TREE_VALUE
per the above and we don't notice that TREE_PURPOSE is error_mark_node.
Did I explain myself well enough?
Thanks,
Paolo.
More information about the Gcc-patches
mailing list