Add noexcept to no_cfi_icall templates

Change-Id: I6072855a3ae792ee810854d330984a983ff6ce2e
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2441392
Reviewed-by: Mark Mentovai <mark@chromium.org>
GitOrigin-RevId: 79d43b8ac37bfdd2c7cf3c367569485fa9b52506
diff --git a/util/misc/no_cfi_icall.h b/util/misc/no_cfi_icall.h
index 0d131e5..dcd0b9b 100644
--- a/util/misc/no_cfi_icall.h
+++ b/util/misc/no_cfi_icall.h
@@ -50,7 +50,7 @@
 struct FunctorTraits;
 
 template <typename R, typename... Args>
-struct FunctorTraits<R (*)(Args...)> {
+struct FunctorTraits<R (*)(Args...) noexcept> {
   template <typename Function, typename... RunArgs>
   DISABLE_CFI_ICALL static R Invoke(Function&& function, RunArgs&&... args) {
     return std::forward<Function>(function)(std::forward<RunArgs>(args)...);
@@ -58,7 +58,7 @@
 };
 
 template <typename R, typename... Args>
-struct FunctorTraits<R (*)(Args..., ...)> {
+struct FunctorTraits<R (*)(Args..., ...) noexcept> {
   template <typename Function, typename... RunArgs>
   DISABLE_CFI_ICALL static R Invoke(Function&& function, RunArgs&&... args) {
     return std::forward<Function>(function)(std::forward<RunArgs>(args)...);
@@ -67,7 +67,7 @@
 
 #if defined(OS_WIN) && defined(ARCH_CPU_X86)
 template <typename R, typename... Args>
-struct FunctorTraits<R(__stdcall*)(Args...)> {
+struct FunctorTraits<R(__stdcall*)(Args...) noexcept> {
   template <typename... RunArgs>
   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 680edbb..5654a2f 100644
--- a/util/misc/no_cfi_icall_test.cc
+++ b/util/misc/no_cfi_icall_test.cc
@@ -34,13 +34,16 @@
 namespace {
 
 TEST(NoCfiIcall, NullptrIsFalse) {
-  NoCfiIcall<void (*)(void)> call(nullptr);
+  NoCfiIcall<void (*)(void) noexcept> call(nullptr);
   ASSERT_FALSE(call);
 }
 
+int TestFunc() noexcept {
+  return 42;
+}
+
 TEST(NoCfiIcall, SameDSOICall) {
-  static int (*func)() = []() { return 42; };
-  NoCfiIcall<decltype(func)> call(func);
+  NoCfiIcall<decltype(TestFunc)*> call(&TestFunc);
   ASSERT_TRUE(call);
   ASSERT_EQ(call(), 42);
 }