All quotes are from N3797.
4/3 [conv]
An expression e can be implicitly converted to a type T if and only if the
Yes, your analysis is correct; I came to the same conclusion here.
According to Daniel Kruegler, this issue should appear on the library defect list subsequent to the next mailing:
A corresponding library issue has already been submitted, but is not yet visible in the issue list.
Hopefully once that becomes visible we'll also have a conclusive answer to whether it is allowable to construct a std::function
with signature returning void
passing a callable with signature returning non-void (Using `std::function
Update: this was entered as LWG 2420, which was resolved in favor of special-casing void
return type to static_cast
the result of the invoked function to void
. This means that a callable returning non-void
can be the target of a std::function
. LWG2420 was applied as a post-publication correction to C++14; meanwhile, all compilers I'm aware of effectively apply this behavior as an extension in C++11 mode.