aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/AST/ComputeDependence.cpp
diff options
context:
space:
mode:
authorErich Keane <erich.keane@intel.com>2022-09-23 08:03:41 -0700
committerErich Keane <erich.keane@intel.com>2022-09-26 06:33:48 -0700
commite3d14bee238b672a7a112311eefee55e142eaefc (patch)
tree417053d5655c80e1d3f917e032ef7d5ead6bcd56 /clang/lib/AST/ComputeDependence.cpp
parent7876469c77a61a22172c765004e6251f26ee3c94 (diff)
downloadllvm-e3d14bee238b672a7a112311eefee55e142eaefc.zip
llvm-e3d14bee238b672a7a112311eefee55e142eaefc.tar.gz
llvm-e3d14bee238b672a7a112311eefee55e142eaefc.tar.bz2
[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.
Diffstat (limited to 'clang/lib/AST/ComputeDependence.cpp')
-rw-r--r--clang/lib/AST/ComputeDependence.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/clang/lib/AST/ComputeDependence.cpp b/clang/lib/AST/ComputeDependence.cpp
index 1f57334..334897b 100644
--- a/clang/lib/AST/ComputeDependence.cpp
+++ b/clang/lib/AST/ComputeDependence.cpp
@@ -853,7 +853,10 @@ ExprDependence clang::computeDependence(ConceptSpecializationExpr *E,
ExprDependence D =
ValueDependent ? ExprDependence::Value : ExprDependence::None;
- return D | toExprDependence(TA);
+ auto Res = D | toExprDependence(TA);
+ if(!ValueDependent && E->getSatisfaction().ContainsErrors)
+ Res |= ExprDependence::Error;
+ return Res;
}
ExprDependence clang::computeDependence(ObjCArrayLiteral *E) {