This is an archive of the discontinued LLVM Phabricator instance.

Patch for bug #17819
ClosedPublic

Authored by mclow.lists on Apr 1 2014, 8:17 PM.

Details

Summary

The problem is that packaged_task uses an allocator to allocate memory for the packaged_task. If you don't pass it one, it uses std::allocator<function_type>. That's fine for functors in general, and function pointers, but not for actual functions. You can't create a std::allocator<void(int)>.

What I've done here is add a call to decay<> on the function type. This has no effect for structs, nor std::function, nor lambdas, etc, but a function will decay to a function pointer, which we can instantiate and allocator for.

Diff Detail

Event Timeline

mclow.lists accepted this revision.Apr 7 2014, 6:39 AM

Closed by revision 205709

mclow.lists closed this revision.Jul 24 2014, 8:43 AM