Skip to content

Commit 5131b07

Browse files
committed
Fix dangling references in tests
1 parent d80c759 commit 5131b07

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

tests/call.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,26 @@ TEST_CASE("Call", "[call]") {
2121

2222
{
2323
b o;
24-
tl::function_ref<void(b&)> fr = &b::baz;
24+
auto x = &b::baz;
25+
tl::function_ref<void(b&)> fr = x;
2526
fr(o);
2627
REQUIRE(o.baz_called);
27-
fr = &b::qux;
28+
x = &b::qux;
29+
fr = x;
2830
fr(o);
2931
REQUIRE(o.qux_called);
3032
}
3133

3234
{
33-
tl::function_ref<int()> fr = []{ return 42; };
35+
auto x = []{ return 42; };
36+
tl::function_ref<int()> fr = x;
3437
REQUIRE(fr() == 42);
3538
}
3639

3740
{
3841
int i = 0;
39-
tl::function_ref<void()> fr = [&i]{ i = 42; };
42+
auto x = [&i]{ i = 42; };
43+
tl::function_ref<void()> fr = x;
4044
fr();
4145
REQUIRE(i == 42);
4246
}

0 commit comments

Comments
 (0)