diff options
author | Patrick Palka <ppalka@redhat.com> | 2022-02-08 08:46:32 -0500 |
---|---|---|
committer | Patrick Palka <ppalka@redhat.com> | 2022-02-08 08:46:32 -0500 |
commit | db5f1c17031ad8a898d77121f1e0e0141306e22a (patch) | |
tree | ba7bfaa7d82679b892b618cef4dad13d5d3a72a3 /gcc/cp/constraint.cc | |
parent | 34ba3d9a2bf72742b1c150a2dd17d10e3e3f0964 (diff) | |
download | gcc-db5f1c17031ad8a898d77121f1e0e0141306e22a.zip gcc-db5f1c17031ad8a898d77121f1e0e0141306e22a.tar.gz gcc-db5f1c17031ad8a898d77121f1e0e0141306e22a.tar.bz2 |
c++: lambda in pack expansion using pack in constraint [PR103706]
Here when expanding the pack expansion pattern containing a constrained
lambda, the template argument for each Ts is an ARGUMENT_PACK_SELECT,
which we store inside the lambda's LAMBDA_EXPR_REGEN_INFO. Then during
satisfaction of the lambda's constraint C<Ts> the satisfaction cache
uses this argument as part of the key to the corresponding sat_entry, but
iterative_hash_template_arg and template_args_equal deliberately don't
handle ARGUMENT_PACK_SELECT.
Since it's wrong to preserve ARGUMENT_PACK_SELECT inside a hash table
due to its instability (as documented in iterative_hash_template_arg),
this patch helps make sure the satisfaction cache doesn't see such trees
by resolving ARGUMENT_PACK_SELECT arguments before adding them to
LAMBDA_EXPR_REGEN_INFO.
PR c++/103706
gcc/cp/ChangeLog:
* pt.cc (preserve_args): New function.
(tsubst_lambda_expr): Use it when setting LAMBDA_EXPR_REGEN_INFO.
gcc/testsuite/ChangeLog:
* g++.dg/cpp2a/concepts-lambda19.C: New test.
Diffstat (limited to 'gcc/cp/constraint.cc')
0 files changed, 0 insertions, 0 deletions