Boost C++ Libraries: Ticket #11266: boost::packaged_task has invalid variadic signature https://svn.boost.org/trac10/ticket/11266 <p> The following code doesn't compile: </p> <pre class="wiki">#define BOOST_THREAD_VERSION 4 #include &lt;boost/thread/future.hpp&gt; void func(int) { } int main() { boost::packaged_task&lt;void(int)&gt; task{func}; } </pre><p> Compilation error is caused by the misuse of <code>BOOST_THREAD_RV_REF</code> macro. Constructor expects argument of type <code>void(int&amp;&amp;)</code> and can't accept <code>func</code>. There is similar issue with <code>operator ()</code>. The file <code>future.hpp</code> needs to be patched: </p> <pre class="wiki">diff --git a/include/boost/thread/future.hpp b/include/boost/thread/future.hpp index e6e2236..e477535 100644 --- a/include/boost/thread/future.hpp +++ b/include/boost/thread/future.hpp @@ -2715,3 +2715,3 @@ #if defined BOOST_THREAD_PROVIDES_SIGNATURE_PACKAGED_TASK &amp;&amp; defined(BOOST_THREAD_PROVIDES_VARIADIC_THREAD) - typedef R (*CallableType)(BOOST_THREAD_RV_REF(ArgTypes) ... ); + typedef R (*CallableType)(ArgTypes ... ); #else @@ -2946,3 +2946,3 @@ #if defined BOOST_THREAD_PROVIDES_SIGNATURE_PACKAGED_TASK &amp;&amp; defined(BOOST_THREAD_PROVIDES_VARIADIC_THREAD) - typedef void (*CallableType)(BOOST_THREAD_RV_REF(ArgTypes)...); + typedef void (*CallableType)(ArgTypes...); #else @@ -3269,3 +3269,3 @@ #if defined BOOST_THREAD_PROVIDES_SIGNATURE_PACKAGED_TASK &amp;&amp; defined(BOOST_THREAD_PROVIDES_VARIADIC_THREAD) - void operator()(BOOST_THREAD_RV_REF(ArgTypes)... args) { + void operator()(ArgTypes... args) { if(!task) { </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/11266 Trac 1.4.3 viboes Thu, 14 May 2015 15:53:42 GMT owner, status changed https://svn.boost.org/trac10/ticket/11266#comment:1 https://svn.boost.org/trac10/ticket/11266#comment:1 <ul> <li><strong>owner</strong> changed from <span class="trac-author">Anthony Williams</span> to <span class="trac-author">viboes</span> </li> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> </ul> <p> Hi, you are surely right. I will take a look soon. </p> Ticket viboes Thu, 14 May 2015 16:10:16 GMT <link>https://svn.boost.org/trac10/ticket/11266#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11266#comment:2</guid> <description> <p> It seems that the last change is not really needed. </p> <pre class="wiki">- void operator()(BOOST_THREAD_RV_REF(ArgTypes)... args) { + void operator()(ArgTypes... args) { </pre><p> Please, could you confirm? </p> </description> <category>Ticket</category> </item> <item> <author>Alexander Karzhenkov <karzhenkov@…></author> <pubDate>Thu, 14 May 2015 17:29:38 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/11266#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11266#comment:3</guid> <description> <p> It's needed. Just try slightly modified test: </p> <pre class="wiki">#define BOOST_THREAD_VERSION 4 #include &lt;boost/thread/future.hpp&gt; void func(int) { } int main() { boost::packaged_task&lt;void(int)&gt; task{func}; task(0); // ok int x = 0; task(x); // compile error: can't bind to rvalue reference } </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Fri, 15 May 2015 13:38:08 GMT</pubDate> <title>milestone changed https://svn.boost.org/trac10/ticket/11266#comment:4 https://svn.boost.org/trac10/ticket/11266#comment:4 <ul> <li><strong>milestone</strong> <span class="trac-field-old">To Be Determined</span> → <span class="trac-field-new">Boost 1.59.0</span> </li> </ul> <p> Agreed and applied <a class="ext-link" href="https://github.com/boostorg/thread/commit/aafd5ca7265e9edea1f100df88eb90c7653a70fc"><span class="icon">​</span>https://github.com/boostorg/thread/commit/aafd5ca7265e9edea1f100df88eb90c7653a70fc</a> </p> Ticket viboes Thu, 13 Aug 2015 06:59:28 GMT milestone changed https://svn.boost.org/trac10/ticket/11266#comment:5 https://svn.boost.org/trac10/ticket/11266#comment:5 <ul> <li><strong>milestone</strong> <span class="trac-field-old">Boost 1.59.0</span> → <span class="trac-field-new">Boost 1.60.0</span> </li> </ul> Ticket viboes Wed, 02 Sep 2015 18:11:05 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/11266#comment:6 https://svn.boost.org/trac10/ticket/11266#comment:6 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> <a class="ext-link" href="https://github.com/boostorg/thread/commit/a3497e1ffceb14318ff09e339a53293926351057"><span class="icon">​</span>https://github.com/boostorg/thread/commit/a3497e1ffceb14318ff09e339a53293926351057</a> </p> Ticket