[clang] [LifetimeSafety] Fix compiler crash with `static operator()` (PR #187853)

Utkarsh Saxena via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 23 03:23:04 PDT 2026


================
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -fsyntax-only -std=c++23 -Wlifetime-safety -Wno-dangling -verify %s
+// RUN: %clang_cc1 -fsyntax-only -std=c++23 -flifetime-safety-inference -fexperimental-lifetime-safety-tu-analysis -Wlifetime-safety -Wno-dangling -verify %s
+
+// expected-no-diagnostics
+struct S {
+  static S operator()(int, int&&);
+};
+
+void indexing_with_static_operator() {
+  S()(1, 2);
+}
----------------
usx95 wrote:

Please move this to warn-lifetime-safety.cpp in a separate namespace.

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


More information about the cfe-commits mailing list