[llvm] Fix a dangling reference in FunctionRefTest.cpp (PR #114949)
Haojian Wu via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 5 00:15:28 PST 2024
https://github.com/hokein created https://github.com/llvm/llvm-project/pull/114949
None
>From 6f9e348e599a780157fcabb036397f947195301b Mon Sep 17 00:00:00 2001
From: Haojian Wu <hokein.wu at gmail.com>
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 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