This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] PR c++/53609 - Wrong argument deduction for pack expansion in argument pack

It seems like your new code is a generalization of the old code for handling substitution of a pack for itself (arg_from_parm_pack and such) and the code for handling other packs with a single pack expansion argument, and should replace those rather than adding on.

The solution that if at a certain index all the packs have expansion arguments then the substitution produces a pack expansion seems right to me, but if one pack has an expansion and another pack has a normal argument, we can't do the substitution and need to fall back on the PACK_EXPANSION_EXTRA_ARGS mechanism.

+set_arg_pack_select_index_for_pack_expansion (tree aps,
+					      int i,
+					      tree arg_pack)
+  if (any_non_real_argument_pack_element_p (arg_pack))

I don't think we care if *any* element is an expansion (and please talk about expansions rather than "non-real elements"). What we care about is whether the i'th element is an expansion. And we need to compare all the pack elements, so I think this needs to be handled in the main function rather than encapsulated here.

+	TREE_VEC_ELT (args_vec, i) =
+	  TREE_VEC_ELT (ARGUMENT_PACK_ARGS (arg_pack), i);

Aren't the LHS and RHS the same location here?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]