Skip to content

Commit 3ed1c49

Browse files
committed
Added constexpr lambda test to delegate unit tests
1 parent 94e243e commit 3ed1c49

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

test/test_delegate.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,8 @@ namespace
265265
Functor functor_static;
266266
const FunctorConst const_functor_static;
267267
#endif
268+
269+
static auto global_lambda = [](int i, int j) { function_called = FunctionCalled::Lambda_Called; parameter_correct = (i == VALUE1) && (j == VALUE2); };
268270
}
269271

270272
namespace
@@ -539,7 +541,7 @@ namespace
539541
#if ETL_USING_CPP17
540542
TEST_FIXTURE(SetupFixture, test_make_delegate_free_moveableonly_constexpr)
541543
{
542-
constexpr auto d = etl::make_delegate<&free_moveableonly>);
544+
constexpr auto d = etl::make_delegate<&free_moveableonly>();
543545

544546
MoveableOnlyData data;
545547
data.d = VALUE1;
@@ -567,10 +569,9 @@ namespace
567569
//*************************************************************************
568570
TEST_FIXTURE(SetupFixture, test_constexpr_lambda_int)
569571
{
570-
constexpr auto lambda = [](int i, int j) { function_called = FunctionCalled::Lambda_Called; parameter_correct = (i == VALUE1) && (j == VALUE2); };
571-
constexpr void(*func_ptr)(int, int) = lambda;
572+
static constexpr void(*global_func_ptr)(int, int) = global_lambda;
572573

573-
auto d = etl::delegate<void(int, int)>::create<func_ptr>();
574+
auto d = etl::delegate<void(int, int)>::create<global_func_ptr>();
574575

575576
d(VALUE1, VALUE2);
576577

0 commit comments

Comments
 (0)