[llvm] Fix a dangling reference in FunctionRefTest.cpp (PR #114949)

via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 5 00:16:02 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-adt

Author: Haojian Wu (hokein)

<details>
<summary>Changes</summary>



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


1 Files Affected:

- (modified) llvm/unittests/ADT/FunctionRefTest.cpp (+2-2) 


``````````diff
diff --git a/llvm/unittests/ADT/FunctionRefTest.cpp b/llvm/unittests/ADT/FunctionRefTest.cpp
index b1819339730370..6ad40406cdf384 100644
--- a/llvm/unittests/ADT/FunctionRefTest.cpp
+++ b/llvm/unittests/ADT/FunctionRefTest.cpp
@@ -60,11 +60,11 @@ TEST(FunctionRefTest, SFINAE) {
 }
 
 TEST(FunctionRefTest, Equality) {
-  function_ref<int()> X = [] { return 1; };
+  const auto Lambda = []() { return 0; };
+  function_ref<int()> X = Lambda;
   function_ref<int()> Y = X;
   EXPECT_EQ(X, Y);
 
-  const auto Lambda = []() { return 0; };
   function_ref<int()> A(Lambda), B(Lambda);
   EXPECT_EQ(A, B);
 }

``````````

</details>


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


More information about the llvm-commits mailing list