[PATCH] D134542: [Concepts] Recover properly from a RecoveryExpr in a concept

Erich Keane via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 23 08:11:44 PDT 2022


erichkeane created this revision.
erichkeane added a reviewer: clang-language-wg.
Herald added a project: All.
erichkeane requested review of this revision.

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.


https://reviews.llvm.org/D134542

Files:
  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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D134542.462492.patch
Type: text/x-patch
Size: 17597 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220923/8d5e3d90/attachment-0001.bin>


More information about the cfe-commits mailing list