This is an archive of the discontinued LLVM Phabricator instance.

[libcxx] Fix PR 22468 - std::function<void()> does not accept non-void-returning functions
ClosedPublic

Authored by EricWF on Feb 5 2015, 11:09 AM.

Details

Summary

The bug can be found here: http://llvm.org/bugs/show_bug.cgi?id=22468

__invoke_void_return_wrapper is needed to properly handle calling a function that returns a value but where the std::function return type is void. Without this '-Wsystem-headers' will cause function::operator()(...) to not compile.

Diff Detail

Event Timeline

EricWF updated this revision to Diff 19420.Feb 5 2015, 11:09 AM
EricWF retitled this revision from to [libcxx] Fix PR 22468 - std::function<void()> does not accept non-void-returning functions .
EricWF updated this object.
EricWF edited the test plan for this revision. (Show Details)
EricWF added reviewers: mclow.lists, K-ballo, eugenis.
EricWF added a subscriber: Unknown Object (MLST).
K-ballo edited edge metadata.Feb 6 2015, 1:03 PM

The current functionality is correct as LWG2420 has not yet been accepted (note I'm the submitter). I'm sitting on a patch to implement the currently intended resolution (apply change to INVOKE, not just function) in a considerably simpler way, waiting for that direction to be confirmed.

EricWF added a comment.Feb 6 2015, 2:54 PM

Could you email me the patch?

EricWF added a comment.Feb 9 2015, 8:34 AM

I'm going to move forward with this patch because K-ballo's patch had an issue with types that overloaded operator comma as a free function.

After we found some corner cases where my simpler approach does the wrong thing, I think Eric's patch is the way to go.

mclow.lists edited edge metadata.Feb 9 2015, 4:46 PM

I tried applying this change and running the tests under C++03, and there's a lot of failures due to the file support/count_new.hpp using C++11 features.

test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_F.pass.cpp
87

While you're here, can you wrap this test in an #if __cplusplus >= 201103L so that this test will pass on C++03?

No std::bind in '03

EricWF updated this revision to Diff 19681.Feb 10 2015, 7:29 AM
EricWF edited edge metadata.

I upstreamed the C++03 fixes for the tests and then regenerated the diff against ToT.

mclow.lists accepted this revision.Feb 10 2015, 8:30 AM
mclow.lists edited edge metadata.

LGTM

This revision is now accepted and ready to land.Feb 10 2015, 8:30 AM
EricWF closed this revision.Feb 10 2015, 8:50 AM