c++: More precise tracking of potentially unstable satisfaction
authorPatrick Palka <ppalka@redhat.com>
Fri, 18 Dec 2020 03:18:09 +0000 (22:18 -0500)
committerPatrick Palka <ppalka@redhat.com>
Fri, 18 Dec 2020 03:18:09 +0000 (22:18 -0500)
commit731a32b3fa779bd5bcff7571ce66b8a79ee2d336
treeaf7ca9afcb418f9d02ee14a651b0873fc7754090
parent79f57d5cb070bb02ea0a34b5f42658d6659b19a8
c++: More precise tracking of potentially unstable satisfaction

This makes tracking of potentially unstable satisfaction results more
precise by recording the specific types for which completion failed
during satisfaction.  We now recompute a satisfaction result only if one
of these types has been completed since the last time we computed the
satisfaction result.  Thus the number of times that we recompute a
satisfaction result is now bounded by the number of such incomplete
types, rather than being effectively unbounded.  This allows us to
remove the invalid assumption in note_ftc_for_satisfaction that was
added to avoid a compile time performance regression in cmcstl2 due to
repeated recomputation of a satisfaction result that depended on
completion of a permanently incomplete class template specialization.

In order to continue to detect the instability in concepts-complete3.C,
we also need to explicitly keep track of return type deduction failure
alongside type completion failure.  So this patch also adds a call to
note_ftc_for_satisfaction in require_deduced_type.

gcc/cp/ChangeLog:

* constraint.cc (satisfying_constraint): Move up definition
and give it bool type.
(failed_type_completion_count): Replace with ...
(failed_type_completions): ... this.
(note_failed_type_completion_for_satisfaction): Append the
supplied argument to failed_type_completions.
(some_type_complete_p): Define.
(sat_entry::maybe_unstable): Replace with ...
(sat_entry::ftc_begin, sat_entry::ftc_end): ... these.
(satisfaction_cache::ftc_count): Replace with ...
(satisfaction_cache::ftc_begin): ... this.
(satisfaction_cache::satisfaction_cache): Adjust accordingly.
(satisfaction_cache::get): Adjust accordingly, using
some_type_complete_p.
(satisfaction_cache::save): Adjust accordingly.
(satisfying_constraint_p): Remove unused function.
(satisfy_constraint): Set satisfying_constraint.
(satisfy_declaration_constraints): Likewise.
* decl.c (require_deduced_type): Call
note_failed_type_completion_for_satisfaction.
gcc/cp/constraint.cc
gcc/cp/decl.c