[Concepts] Correctly handle failure when checking concepts recursively
authorErich Keane <erich.keane@intel.com>
Mon, 31 Oct 2022 15:43:08 +0000 (08:43 -0700)
committerErich Keane <erich.keane@intel.com>
Tue, 1 Nov 2022 19:18:58 +0000 (12:18 -0700)
commit2cee2663338ee65ff5786432c30ba22c8dcd711b
tree3d805d6b450d3c9ab332d59999e0ed81ddc1a796
parent72ba2489f2c7b0a911bd23e50aaaca6eae9a183e
[Concepts] Correctly handle failure when checking concepts recursively

Based on discussion on the core reflector, it was made clear that a
concept that depends on itself should be a hard error, not a constraint
failure. This patch implements a stack of constraint-checks-in-progress
to make sure we quit, rather than hitting stack-exhaustion.

Note that we DO need to be careful to make sure we still check
constraints properly that are caused by a previous constraint, but not
derived from (such as when a check causes us to check special member
function generation), so we cannot use the existing logic to see if this
is being instantiated.

This fixes https://github.com/llvm/llvm-project/issues/44304 and
https://github.com/llvm/llvm-project/issues/50891.

Differential Revision: https://reviews.llvm.org/D136975
clang/docs/ReleaseNotes.rst
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/include/clang/Sema/Sema.h
clang/lib/Sema/SemaConcept.cpp
clang/lib/Sema/SemaDeclCXX.cpp
clang/lib/Sema/SemaOverload.cpp
clang/test/SemaTemplate/concepts-GH53213.cpp [deleted file]
clang/test/SemaTemplate/concepts-recursive-inst.cpp [new file with mode: 0644]