diff --git a/util/misc/no_cfi_icall.h b/util/misc/no_cfi_icall.h index 0d131e57..dcd0b9bf 100644 --- a/util/misc/no_cfi_icall.h +++ b/util/misc/no_cfi_icall.h @@ -50,7 +50,7 @@ template struct FunctorTraits; template -struct FunctorTraits { +struct FunctorTraits { template DISABLE_CFI_ICALL static R Invoke(Function&& function, RunArgs&&... args) { return std::forward(function)(std::forward(args)...); @@ -58,7 +58,7 @@ struct FunctorTraits { }; template -struct FunctorTraits { +struct FunctorTraits { template DISABLE_CFI_ICALL static R Invoke(Function&& function, RunArgs&&... args) { return std::forward(function)(std::forward(args)...); @@ -67,7 +67,7 @@ struct FunctorTraits { #if defined(OS_WIN) && defined(ARCH_CPU_X86) template -struct FunctorTraits { +struct FunctorTraits { template DISABLE_CFI_ICALL static R Invoke(R(__stdcall* function)(Args...), RunArgs&&... args) { diff --git a/util/misc/no_cfi_icall_test.cc b/util/misc/no_cfi_icall_test.cc index 680edbb8..5654a2f4 100644 --- a/util/misc/no_cfi_icall_test.cc +++ b/util/misc/no_cfi_icall_test.cc @@ -34,13 +34,16 @@ namespace test { namespace { TEST(NoCfiIcall, NullptrIsFalse) { - NoCfiIcall call(nullptr); + NoCfiIcall call(nullptr); ASSERT_FALSE(call); } +int TestFunc() noexcept { + return 42; +} + TEST(NoCfiIcall, SameDSOICall) { - static int (*func)() = []() { return 42; }; - NoCfiIcall call(func); + NoCfiIcall call(&TestFunc); ASSERT_TRUE(call); ASSERT_EQ(call(), 42); }