[llvm-branch-commits] [NFC] [FlowSensitive] [StatusOr] add test for coroutine crash (PR #182604)

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Feb 20 14:19:38 PST 2026


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Florian Mayer (fmayer)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/182604.diff


1 Files Affected:

- (modified) clang/unittests/Analysis/FlowSensitive/UncheckedStatusOrAccessModelTestFixture.cpp (+41) 


``````````diff
diff --git a/clang/unittests/Analysis/FlowSensitive/UncheckedStatusOrAccessModelTestFixture.cpp b/clang/unittests/Analysis/FlowSensitive/UncheckedStatusOrAccessModelTestFixture.cpp
index 5d4558f37bcf6..c5f3b5d94e631 100644
--- a/clang/unittests/Analysis/FlowSensitive/UncheckedStatusOrAccessModelTestFixture.cpp
+++ b/clang/unittests/Analysis/FlowSensitive/UncheckedStatusOrAccessModelTestFixture.cpp
@@ -4516,6 +4516,47 @@ TEST_P(UncheckedStatusOrAccessModelTest, NestedStatusOrInOptional) {
       )cc");
 }
 
+// TODO: this crashes with "Assertion `Children.size() == 1' failed." in
+// ResultObjectVisitor::PropagateResultObject.
+TEST_P(UncheckedStatusOrAccessModelTest, DISABLED_Coroutine) {
+  ExpectDiagnosticsFor(R"cc(
+#include "unchecked_statusor_access_test_defs.h"
+#include "std_coroutine.h"
+
+  template<typename T>
+  struct Task {
+    struct promise_type {
+        Task get_return_object();
+        std::suspend_never initial_suspend() noexcept;
+        std::suspend_always final_suspend() noexcept;
+        void return_value(T v);
+        void unhandled_exception();
+    };
+    bool await_ready() const noexcept;
+    T await_resume() noexcept;
+    void await_suspend(std::coroutine_handle<> handle) noexcept;
+  };
+
+  Task<STATUSOR_INT> call(STATUSOR_INT sor) {
+    if (sor.ok()) {
+      sor.value();
+    } else {
+      sor.value();  // [[unsafe]]
+    }
+    co_return sor;
+  }
+  Task<int> target() {
+    auto x = co_await call(Make<STATUSOR_INT>());
+    if (x.ok()) {
+      co_return x.value();
+    } else {
+      x.value();  // [[unsafe]]
+      co_return 0;
+    }
+  }
+  )cc");
+}
+
 } // namespace
 
 std::string

``````````

</details>


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


More information about the llvm-branch-commits mailing list