Re: [Boost-bugs] [Boost C++ Libraries] #8596: With C++0x enabled, boost::packaged_task stores a reference to function objects, instead of a copy

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #8596: With C++0x enabled, boost::packaged_task stores a reference to function objects, instead of a copy
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-05-20 13:44:43


#8596: With C++0x enabled, boost::packaged_task stores a reference to function
objects, instead of a copy
-----------------------------------------------------------+----------------
  Reporter: Kees-Jan Dijkzeul <kees-jan.dijkzeul@…> | Owner: viboes
      Type: Bugs | Status: assigned
 Milestone: To Be Determined | Component: thread
   Version: Boost 1.53.0 | Severity: Problem
Resolution: | Keywords:
-----------------------------------------------------------+----------------

Comment (by viboes):

 Replying to [comment:1 viboes]:
> Hi and thanks for the report. The concerned code is not any more on
 trunk or release branch. Please could you test your example with one of
 them?

 Forget this. I was thinking you were proposing to apply the patch above.

 Please could you try this patch


 {{{
 svn diff future.hpp
 Index: future.hpp
 ===================================================================
 --- future.hpp (revision 84336)
 +++ future.hpp (working copy)
 @@ -2841,8 +2841,8 @@
              , typename disable_if<is_same<typename decay<F>::type,
 packaged_task>, dummy* >::type=0
              )
          {
 - //typedef typename remove_cv<typename
 remove_reference<F>::type>::type FR;
 - typedef F FR;
 + typedef typename remove_cv<typename
 remove_reference<F>::type>::type FR;
 + //typedef F FR;
  #if defined BOOST_THREAD_PROVIDES_SIGNATURE_PACKAGED_TASK
    #if defined(BOOST_THREAD_PROVIDES_VARIADIC_THREAD)
              typedef detail::task_object<FR,R(ArgTypes...)>
 task_object_type;
 @@ -2852,7 +2852,7 @@
  #else
              typedef detail::task_object<FR,R> task_object_type;
  #endif
 - task = task_ptr(new task_object_type(boost::forward<F>(f)));
 + task = task_ptr(new task_object_type(boost::forward<FR>(f)));
              future_obtained = false;

          }

 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/8596#comment:2>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:13 UTC