This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/42593] [c++0x] [4.5 Regression] std::bind not assignable to std::function



------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]