Skip to content

Commit

Permalink
Fix linux build
Browse files Browse the repository at this point in the history
  • Loading branch information
endurodave committed Dec 30, 2024
1 parent 86c5c07 commit 3e5dfd4
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 49 deletions.
6 changes: 3 additions & 3 deletions src/Delegate/DelegateAsyncWait.h
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ class DelegateFreeAsyncWait<RetType(Args...)> : public DelegateFree<RetType(Args
/// target function, the target function is not called.
/// @param[in] msg The delegate message created and sent within `operator()(Args... args)`.
/// @return `true` if target function invoked or timeout expired; `false` if error.
virtual bool Invoke(std::shared_ptr<DelegateMsg> msg) {
virtual bool Invoke(std::shared_ptr<DelegateMsg> msg) override {
static_assert(!(is_unique_ptr<RetType>::value), "std::unique_ptr return value not allowed");

// Typecast the base pointer to back correct derived to instance
Expand Down Expand Up @@ -769,7 +769,7 @@ class DelegateMemberAsyncWait<TClass, RetType(Args...)> : public DelegateMember<
/// target function, the target function is not called.
/// @param[in] msg The delegate message created and sent within `operator()(Args... args)`.
/// @return `true` if target function invoked or timeout expired; `false` if error.
virtual bool Invoke(std::shared_ptr<DelegateMsg> msg) {
virtual bool Invoke(std::shared_ptr<DelegateMsg> msg) override {
static_assert(!(is_unique_ptr<RetType>::value), "std::unique_ptr return value not allowed");

// Typecast the base pointer to back correct derived to instance
Expand Down Expand Up @@ -1091,7 +1091,7 @@ class DelegateFunctionAsyncWait<RetType(Args...)> : public DelegateFunction<RetT
/// target function, the target function is not called.
/// @param[in] msg The delegate message created and sent within `operator()(Args... args)`.
/// @return `true` if target function invoked or timeout expired; `false` if error.
virtual bool Invoke(std::shared_ptr<DelegateMsg> msg) {
virtual bool Invoke(std::shared_ptr<DelegateMsg> msg) override {
static_assert(!(is_unique_ptr<RetType>::value), "std::unique_ptr return value not allowed");

// Typecast the base pointer to back correct derived to instance
Expand Down
15 changes: 0 additions & 15 deletions tests/UnitTests/DelegateAsyncWait_UT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,21 +201,6 @@ static void DelegateFreeAsyncWaitTests()
for (int i = 0; i < 2; i++)
arr[i](TEST_INT);
delete[] arr;

{
// Should never be called!
auto lambdaInt1 = [](int i) { ASSERT_TRUE(i == TEST_INT); };
TestClass1 testClass1;

// Invalid runtime. Add temporary objects to list should not work. Checks
// that delegate destructor sets delegate Empty() to help prevent misused.
std::list<Delegate<void(int)>*> delList;
delList.push_back(&MakeDelegate(FreeFuncInt1, workerThread, WAIT_INFINITE));
delList.push_back(&MakeDelegate(&testClass1, &TestClass1::MemberFuncInt1, workerThread, WAIT_INFINITE));
delList.push_back(&MakeDelegate(std::function(lambdaInt1), workerThread, WAIT_INFINITE));
for (auto& d : delList)
(*d)(0); // All invalid targets; no delegates called
}
}

static void DelegateMemberAsyncWaitTests()
Expand Down
17 changes: 1 addition & 16 deletions tests/UnitTests/DelegateAsync_UT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ static void DelegateFreeAsyncTests()
auto outgoingArg = MakeDelegate(&OutgoingPtrArg, workerThread);
std::this_thread::sleep_for(std::chrono::milliseconds(500));
outgoingArg(&sparam, &iparam);
ASSERT_TRUE(sparam.val == TEST_INT);
ASSERT_TRUE(sparam.val == TEST_INT);
ASSERT_TRUE(iparam == 100);

// Test outgoing ptr-ptr argument
Expand Down Expand Up @@ -200,21 +200,6 @@ static void DelegateFreeAsyncTests()
for (int i = 0; i < 2; i++)
arr[i](TEST_INT);
delete[] arr;

{
// Should never be called!
auto lambdaInt1 = [](int i) { ASSERT_TRUE(i == TEST_INT); };
TestClass1 testClass1;

// Invalid runtime. Add temporary objects to list should not work. Checks
// that delegate destructor sets delegate Empty() to help prevent misused.
std::list<Delegate<void(int)>*> delList;
delList.push_back(&MakeDelegate(FreeFuncInt1, workerThread));
delList.push_back(&MakeDelegate(&testClass1, &TestClass1::MemberFuncInt1, workerThread));
delList.push_back(&MakeDelegate(std::function(lambdaInt1), workerThread));
for (auto& d : delList)
(*d)(0); // All invalid targets; no delegates called
}
}

static void DelegateMemberAsyncTests()
Expand Down
15 changes: 0 additions & 15 deletions tests/UnitTests/Delegate_UT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,21 +203,6 @@ static void DelegateFreeTests()
for (int i = 0; i < 2; i++)
arr[i](TEST_INT);
delete[] arr;

{
// Should never be called!
auto lambdaInt1 = [](int i) { ASSERT_TRUE(i == TEST_INT); };
TestClass1 testClass1;

// Invalid runtime. Add temporary objects to list should not work. Checks
// that delegate destructor sets delegate Empty() to help prevent misused.
std::list<Delegate<void(int)>*> delList;
delList.push_back(&MakeDelegate(FreeFuncInt1));
delList.push_back(&MakeDelegate(&testClass1, &TestClass1::MemberFuncInt1));
delList.push_back(&MakeDelegate(std::function(lambdaInt1)));
for (auto& d : delList)
(*d)(0); // All invalid targets; no delegates called
}
}

static void DelegateMemberTests()
Expand Down

0 comments on commit 3e5dfd4

Please sign in to comment.