[clang] [-Wunsafe-buffer-usage] Check isValueDependent before EvaluateAsBooleanCondition (PR #172091)

Balázs Benics via cfe-commits cfe-commits at lists.llvm.org
Sat Dec 13 11:20:38 PST 2025


================
@@ -29,3 +29,16 @@ void f(int x, int y) {
   return;
 }
 
+// Test that the analysis will not crash when a conditional expression
+// appears in dependent context:
+#ifdef __cplusplus
+struct Foo {
+  static void static_method(int);
+};
+void conditional_inside_dependent_context(void) {
+  auto lambda = [](auto result) { // opens a dependent context
+    Foo::static_method(result ? 1 : 2);
----------------
steakhal wrote:

```suggestion
    Foo::static_method(result ? 1 : 2); // no-crash
```

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


More information about the cfe-commits mailing list