1
0
forked from 0ad/0ad

Use lambda capture in tests

This fixes -Wunused-lambda-capture with FreeBSD's clang17.
This commit is contained in:
Nicolas Auvray 2024-08-29 09:13:29 +02:00
parent 9759265efe
commit 92f34936bd
Signed by: Itms
GPG Key ID: C7E52BD14CE14E09

View File

@ -116,7 +116,7 @@ public:
void test_move_only_function()
{
Future<void> future;
Future<int> future;
class MoveOnlyType
{
@ -126,8 +126,12 @@ public:
MoveOnlyType& operator=(MoveOnlyType&) = delete;
MoveOnlyType(MoveOnlyType&&) = default;
MoveOnlyType& operator=(MoveOnlyType&&) = default;
int fn() const { return 7; }
};
future.Wrap([t = MoveOnlyType{}]{});
auto task = future.Wrap([t = MoveOnlyType{}]{ return t.fn(); });
task();
TS_ASSERT_EQUALS(future.Get(), 7);
}
};