Should int(*)()
be convertible to inplace_function<void()>
?
#159
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Before this patch, we reported that
is_convertible<int(*)(), inplace_function<void()>>
,but if you actually tried to do it, you got a compiler error down in the guts
of
inplace_function
.After this patch, we let you do it.
However, see issue #150: I think anyone who relies on this behavior is probably
doing so unintentionally (and their code is probably wrong). Therefore, maybe we
should change our SFINAE so that
is_convertible<int(*)(), inplace_function<void()>>
would be
false
.I'm posting this PR to get opinions (e.g. @Voultapher @p-groarke), not necessarily because I think it's the right approach (frankly I don't). Vice versa, if we decide to make
is_convertible<int(*)(), inplace_function<void()>> == false
, then we'll have to bikeshed the right way to do that. Should we eliminate the special cases in ourdetail::is_invocable_r_impl
, and if so, should we rename it so that people don't confuse it with the standardis_invocable_r
?