From 04ba09fe9a8432ddb2c196964571ed5cda1e430b Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Tue, 5 Nov 2024 16:49:54 +0100 Subject: [PATCH] Fix a dangling reference in FunctionRefTest.cpp (#114949) --- llvm/unittests/ADT/FunctionRefTest.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 X = [] { return 1; }; + const auto Lambda = []() { return 0; }; + function_ref X = Lambda; function_ref Y = X; EXPECT_EQ(X, Y); - const auto Lambda = []() { return 0; }; function_ref A(Lambda), B(Lambda); EXPECT_EQ(A, B); }