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

Younan Zhang via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 20 06:10:47 PST 2026


================
@@ -0,0 +1,19 @@
+// RUN: not %clang_cc1 -std=c++23 -fsyntax-only %s 2>&1 | FileCheck %s
+// Regression test: don't crash when an expression requirement becomes a
+// substitution failure during template instantiation (see #176402).
+
+void f() {
+    auto recursiveLambda = [](auto self, int depth) -> void {
+        struct MyClass;
+        auto testConcept = []<typename T> {
+            return requires(T) { &MyClass::operator0 }
+        };
+    };
+    recursiveLambda(recursiveLambda, 5);
+}
+
+// CHECK: error:
----------------
zyn0217 wrote:

we use -check instead of FileCheck.

See any tests in the same directory for examples.


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


More information about the cfe-commits mailing list