[clang] [Clang] Avoid crash when expression requirements are substitution failures (PR #176896)

Shafik Yaghmour via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 20 10:21:51 PST 2026


================
@@ -101,8 +101,13 @@ concepts::ExprRequirement::ReturnTypeRequirement::getTypeConstraint() const {
 // Search through the requirements, and see if any have a RecoveryExpr in it,
 // which means this RequiresExpr ALSO needs to be invalid.
 static bool RequirementContainsError(concepts::Requirement *R) {
-  if (auto *ExprReq = dyn_cast<concepts::ExprRequirement>(R))
-    return ExprReq->getExpr() && ExprReq->getExpr()->containsErrors();
+  if (auto *ExprReq = dyn_cast<concepts::ExprRequirement>(R)) {
+    if (ExprReq->isExprSubstitutionFailure())
+      return true;
+    if (auto *E = ExprReq->getExpr())
+      return E->containsErrors();
+    return false;
----------------
shafik wrote:

ahh yes, that was not obvious from the diff, the github diffs are not great sometimes.

https://github.com/llvm/llvm-project/pull/176896


More information about the cfe-commits mailing list