[Concepts] Recover properly from a RecoveryExpr in a concept
authorErich Keane <erich.keane@intel.com>
Fri, 23 Sep 2022 15:03:41 +0000 (08:03 -0700)
committerErich Keane <erich.keane@intel.com>
Mon, 26 Sep 2022 13:33:48 +0000 (06:33 -0700)
commite3d14bee238b672a7a112311eefee55e142eaefc
tree417053d5655c80e1d3f917e032ef7d5ead6bcd56
parent7876469c77a61a22172c765004e6251f26ee3c94
[Concepts] Recover properly from a RecoveryExpr in a concept

Discovered by reducing a different problem, we currently assert because
we failed to make the constraint expressions not dependent, since a
RecoveryExpr cannot be transformed.

This patch fixes that, and gets reasonably nice diagnostics by
introducing a concept (hah!) of "ContainsErrors" to the Satisfaction
types, which causes us to treat the candidate as non-viable.

However, just making THAT candidate non-viable would result in choosing
the 'next best' canddiate, which can result in awkward errors, where we
start evaluating a candidate that is not intended to be selected.
Because of this, and to make diagnostics more relevant, we now just
cause the entire lookup to result in a 'no-viable-candidates'.

This means we will only emit the list of candidates, rather than any
cascading failures.
clang/docs/ReleaseNotes.rst
clang/include/clang/AST/ASTConcept.h
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/include/clang/Sema/Overload.h
clang/lib/AST/ASTConcept.cpp
clang/lib/AST/ComputeDependence.cpp
clang/lib/Sema/SemaConcept.cpp
clang/lib/Sema/SemaOverload.cpp
clang/lib/Serialization/ASTReaderStmt.cpp
clang/lib/Serialization/ASTWriterStmt.cpp
clang/test/SemaTemplate/concepts-recovery-expr.cpp [new file with mode: 0644]