-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
When the first argument is a noexcept member function pointer, yk::polyfill::invoke() is unconditionally decorated with noexcept(true).
In other words, is_nothrow_invocable<T (C::*)(Params...) noexcept, U, Args...>::value is always true, regardless of whether the conversions from Args... to Params... might throw an exception.
#include <yk/polyfill/functional.hpp>
struct ThrowingConvertible {
ThrowingConvertible(int x) noexcept(false) { throw x; }
};
struct S {
void nothrow_member_function(ThrowingConvertible) noexcept {}
};
int main() {
try {
// Expected: Catch the exception thrown by ThrowingConvertible
// Actual: std::terminate() is called because invoke() is noexcept
yk::polyfill::invoke(&S::nothrow_member_function, S{}, 42);
}
catch (...) {
}
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels