From 6f9e348e599a780157fcabb036397f947195301b Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Tue, 5 Nov 2024 09:07:56 +0100 Subject: [PATCH] Fix a dangling reference in FunctionRefTest.cpp --- 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 b181933973037..6ad40406cdf38 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); }