[llvm] 92574b5 - Fix a dangling reference in FunctionRefTest.cpp (#114949)

via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 5 07:49:59 PST 2024


Author: Haojian Wu
Date: 2024-11-05T16:49:54+01:00
New Revision: 92574b5fafa2d0e8efe4082b76a2f179b121df29

URL: https://github.com/llvm/llvm-project/commit/92574b5fafa2d0e8efe4082b76a2f179b121df29
DIFF: https://github.com/llvm/llvm-project/commit/92574b5fafa2d0e8efe4082b76a2f179b121df29.diff

LOG: Fix a dangling reference in FunctionRefTest.cpp (#114949)

Added: 
    

Modified: 
    llvm/unittests/ADT/FunctionRefTest.cpp

Removed: 
    


################################################################################
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);
 }


        


More information about the llvm-commits mailing list