我开始在libc++ master之上实现N3558 (请参见此处),但现在我遇到了一个错误,我不明白。future
functional
无论我如何编码,它总是因__compressed_pair
错误而失败。我不知道是我遗漏了什么还是libc++
.
以下代码:
#include <future>
struct test {
test() {
int someint = 0;
std::promise<void> prom;
auto fut = prom.get_future();
fut.then( [this, someint]( std::future<void> future ) {
} );
}
};
clang 3.3中的触发器:
In file included from /std/include/map:375:
/std/include/functional:993:11: error: no matching constructor for initialization of '__compressed_pair<<lambda at /std/include/future:1096:14>, std::__1::allocator<<lambda at /std/include/future:1096:14> > >'
: __f_(piecewise_construct, _VSTD::forward_as_tuple(_VSTD::move(__f)),
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/std/include/functional:1278:26: note: in instantiation of member function 'std::__1::__function::__func<<lambda at /std/include/future:1096:14>, std::__1::allocator<<lambda at /std/include/future:1096:14> >, void ()>::__func' requested here
::new (__f_) _FF(_VSTD::move(__f));
^
/std/include/__functional_base:341:37: note: in instantiation of function template specialization 'std::__1::function<void ()>::function<<lambda at /std/include/future:1096:14> >' requested here
return _VSTD::forward<_Fp>(__f)(_VSTD::forward<_Args>(__args)...);
^
/std/include/__config:301:15: note: expanded from macro '_VSTD'
#define _VSTD std::_LIBCPP_NAMESPACE
^
/std/include/functional:1691:12: note: in instantiation of function template specialization 'std::__1::__invoke<const <lambda at /std/include/future:1144:17> &, const <lambda at /std/include/future:1096:14> &>' requested here
return __invoke(__f, __mu(get<_Indx>(__bound_args), __args)...);
^
/std/include/functional:1761:20: note: in instantiation of function template specialization 'std::__1::__apply_functor<const <lambda at /std/include/future:1144:17>, const std::__1::tuple<<lambda at /std/include/future:1096:14> >, 0, std::__1::tuple<> >' requested here
return __apply_functor(__f_, __bound_args_, __indices(),
^
/std/include/future:1114:3: note: in instantiation of function template specialization 'std::__1::__bind<<lambda at /std/include/future:1144:17>, <lambda at /std/include/future:1096:14> >::operator()<>' requested here
invoke_bind();
^
/std/include/future:1148:22: note: in instantiation of function template specialization 'std::__1::__then<void>::bind<std::__1::future<void>, <lambda at game/Game_local.cpp:1020:9>, <lambda at /std/include/future:1144:17> >' requested here
return __then<_Rp>::bind( fut, forward<F>(execute_func), move(invoker) );
^
/std/include/future:1527:34: note: in instantiation of function template specialization 'std::__1::__then<void>::bind_async<std::__1::future<void>, <lambda at game/Game_local.cpp:1020:9> >' requested here
{return __then<return_type>::bind_async( *this, std::forward<Function>(func) );}
^
game/local.cpp:1020:3: note: in instantiation of function template specialization 'std::__1::future<void>::then<<lambda at game/Game_local.cpp:1020:9> >' requested here
.then( [this, someint]( std::future<void> future ) {
^
/std/include/memory:2371:31: note: candidate constructor not viable: requires 0 arguments, but 3 were provided
_LIBCPP_INLINE_VISIBILITY __compressed_pair() {}
^
/std/include/memory:2372:40: note: candidate constructor not viable: requires single argument '__t1', but 3 arguments were provided
_LIBCPP_INLINE_VISIBILITY explicit __compressed_pair(_T1_param __t1)
^
/std/include/memory:2374:40: note: candidate constructor not viable: requires single argument '__t2', but 3 arguments were provided
_LIBCPP_INLINE_VISIBILITY explicit __compressed_pair(_T2_param __t2)
^
/std/include/memory:2376:31: note: candidate constructor not viable: requires 2 arguments, but 3 were provided
_LIBCPP_INLINE_VISIBILITY __compressed_pair(_T1_param __t1, _T2_param __t2)
^
/std/include/memory:2357:7: note: candidate constructor (the implicit copy constructor) not viable: requires 1 argument, but 3 were provided
class __compressed_pair
^
/std/include/memory:2357:7: note: candidate constructor (the implicit move constructor) not viable: requires 1 argument, but 3 were provided
使用gcc 4.8编译会给出更难看的错误消息,但基本相同。
任何人都可以解释一下吗?