util/ScopeExit: use std::declval()

Fixes GCC 10 error:

 error: cannot call member function `Foo` without object
This commit is contained in:
Max Kellermann 2023-05-22 15:01:00 +02:00
parent 7a99a7008c
commit dc127f39a7
1 changed files with 1 additions and 1 deletions

View File

@ -50,7 +50,7 @@ public:
"noexcept" declaration allows the destructor to throw if
the function can throw; without this, a throwing function
would std::terminate() */
~ScopeExitGuard() noexcept(noexcept(F::operator()())) {
~ScopeExitGuard() noexcept(noexcept(std::declval<F>()())) {
if (enabled)
F::operator()();
}