This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/42593] [c++0x] [4.5 Regression] std::bind not assignable to std::function
- From: "redi at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 3 Jan 2010 15:07:24 -0000
- Subject: [Bug libstdc++/42593] [c++0x] [4.5 Regression] std::bind not assignable to std::function
- References: <bug-42593-3237@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #3 from redi at gcc dot gnu dot org 2010-01-03 15:07 -------
>From a quick look, I think the problem is that std::function now uses perfect
forwarding, but std::bind doesn't yet.
So invoking the function passes an rvalue to _Bind::operator() which fails to
bind to _Args&
Previously, std::function took its arguments by value, and
_Bind::operator()(_Args&...) bound an lvalue reference to that by-value
parameter:
return _M_invoker(_M_functor, __args...);
Now it does this:
return _M_invoker(_M_functor, std::forward<_ArgTypes>(__args)...);
and so the rvalue cannot bind to _Args&
This will be fixed when std::bind supports rvalue references. I was going to
finish those changes after updating <future>, but I have been delayed by some
unexpected events and am away from my home PC which contains my work in
progress.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42593