c++: Diagnose self-recursive satisfaction
authorPatrick Palka <ppalka@redhat.com>
Fri, 18 Dec 2020 03:18:07 +0000 (22:18 -0500)
committerPatrick Palka <ppalka@redhat.com>
Fri, 18 Dec 2020 03:18:07 +0000 (22:18 -0500)
commit79f57d5cb070bb02ea0a34b5f42658d6659b19a8
treeb7dba72ed8e157d1c7895c62e038be36cba7a903
parent20f292863f6ed230335c443893d4db664a8140d0
c++: Diagnose self-recursive satisfaction

This patch further extends the satisfaction_cache class to diagnose
self-recursive satisfaction.

gcc/cp/ChangeLog:

* constraint.cc (sat_entry::evaluating): New member.
(satisfaction_cache::get): If entry->evaluating, diagnose
self-recursive satisfaction.  Otherwise, set entry->evaluating
if we're not reusing a cached satisfaction result.
(satisfaction_cache::save): Clear entry->evaluating.
(satisfy_atom): Set up diagnosing_failed_constraint before the
first call to get().

gcc/testsuite/ChangeLog:

PR c++/96840
* g++.dg/cpp2a/concepts-pr88395.C: Adjust to expect the
self-recursive satisfaction to get directly diagnosed.
* g++.dg/cpp2a/concepts-recursive-sat2.C: Likewise.
* g++.dg/cpp2a/concepts-recursive-sat4.C: New test.
gcc/cp/constraint.cc
gcc/testsuite/g++.dg/cpp2a/concepts-pr88395.C
gcc/testsuite/g++.dg/cpp2a/concepts-recursive-sat2.C
gcc/testsuite/g++.dg/cpp2a/concepts-recursive-sat4.C [new file with mode: 0644]