Subject: [Boost-bugs] [Boost C++ Libraries] #11266: boost::packaged_task has invalid variadic signature
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2015-05-04 18:51:16
#11266: boost::packaged_task has invalid variadic signature
-------------------------------------------------+----------------------
Reporter: Alexander Karzhenkov <karzhenkov@â¦> | Owner: anthonyw
Type: Bugs | Status: new
Milestone: To Be Determined | Component: thread
Version: Boost 1.58.0 | Severity: Problem
Keywords: packaged_task, variadic |
-------------------------------------------------+----------------------
The following code doesn't compile:
{{{
#define BOOST_THREAD_VERSION 4
#include <boost/thread/future.hpp>
void func(int) { }
int main()
{
boost::packaged_task<void(int)> task{func};
}
}}}
Compilation error is caused by the misuse of `BOOST_THREAD_RV_REF` macro.
Constructor expects argument of type `void(int&&)` and can't accept
`func`. There is similar issue with `operator ()`. The file `future.hpp`
needs to be patched:
{{{
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 &&
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 &&
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 &&
defined(BOOST_THREAD_PROVIDES_VARIADIC_THREAD)
- void operator()(BOOST_THREAD_RV_REF(ArgTypes)... args) {
+ void operator()(ArgTypes... args) {
if(!task) {
}}}
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/11266> 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:18 UTC