On 4/3/23 10:49, Patrick Palka wrote:
This testcase demonstrates we can legitimately enter satisfaction with
an ARGUMENT_PACK_SELECT argument, which is problematic because we can't
store such arguments in the satisfaction cache (or any other hash table).
Since this appears to be possible only during constrained auto deduction
for a return-type-requirement, the most appropriate spot to fix this seems
to be from do_auto_deduction, by calling preserve_args to strip A_P_S args
before entering satisfaction.
+++ b/gcc/cp/pt.cc
@@ -30965,6 +30965,12 @@ do_auto_deduction (tree type, tree init, tree
auto_node,
return type;
}
+ /* We can see an ARGUMENT_PACK_SELECT argument when evaluating
+ a return-type-requirement. Get rid of them before entering
+ satisfaction, since the satisfaction cache can't handle them. */
+ if (context == adc_requirement)
+ outer_targs = preserve_args (outer_targs);
I'd like to get do_auto_deduction out of the business of handling
return-type-requirements, since there is no longer any actual deduction
involved (as there was in the TS). So I'd prefer not to add any more
tweaks there.
Maybe this should happen higher up, in tsubst_requires_expr? Maybe just
before the call to add_extra_args?
Jason