Properly handle finally(actual_function) (#1056)
`finally` needs to use `decay_t` instead of `remove_cvref_t` so it can properly accept non-object function arguments by decaying to function pointer type. Adds test coverage for this use case which was previously missing.
This commit is contained in:
1 parent
8840d87199
commit
d9ffa118c5
2 files changed
+11
-1
No files matched your search
+1
-1
@@ -87,7 +87,7 @@ private:
|
||||
template <class F>
|
||||
GSL_NODISCARD auto finally(F&& f) noexcept
|
||||
{
|
||||
return final_action<std::remove_cv_t<std::remove_reference_t<F>>>{std::forward<F>(f)};
|
||||
return final_action<std::decay_t<F>>{std::forward<F>(f)};
|
||||
}
|
||||
|
||||
// narrow_cast(): a searchable way to do narrowing casts of values
|
||||
|
||||
Reference in new issue
Block a user