Opened 11 years ago
Closed 10 years ago
#6222 closed Bugs (fixed)
Compile error with SunStudio: unique_future move
| Reported by: | anonymous | Owned by: | viboes |
|---|---|---|---|
| Milestone: | Boost 1.50.0 | Component: | thread |
| Version: | Boost 1.48.0 | Severity: | Problem |
| Keywords: | move | Cc: | viboes |
Description
// B.cpp
#include <boost/thread.hpp>
static int function() {
return 42;
}
int main(int argc, const char *argv[]) {
boost::packaged_task<int> pt(function);
boost::unique_future<int> future = pt.get_future();
return 0;
}
When trying to compile this I get this error:
"B.cpp", line 10: Error: boost::unique_future<int>::unique_future(boost::unique_future<int>&) is not accessible from main(int, const char). 1 Error(s) detected.
Change History (8)
comment:1 by , 11 years ago
comment:2 by , 11 years ago
| Component: | None → thread |
|---|---|
| Owner: | set to |
comment:3 by , 11 years ago
| Summary: | Compile error with SunStudio → Compile error with SunStudio: unique_future move |
|---|
comment:4 by , 11 years ago
| Cc: | added |
|---|---|
| Keywords: | move added |
There is an action point to use Boost.Move. Could we consider this as a duplicate of #6194 Adapt to Boost.Move.
comment:5 by , 11 years ago
| Owner: | changed from to |
|---|---|
| Status: | new → assigned |
comment:6 by , 11 years ago
The current implementation doesn't works on SunStudio as it is preferring the overload to the private constructor instead of the conversion.
I have added a move() member function that should help to force the conversion in trunk. You can add the following
boost::detail::thread_move_t<unique_future> move()
{
return boost::detail::thread_move_t<unique_future>(*this);
}
Could you try this
boost::unique_future<int> future = pt.get_future().move();
Let me now if this work for you. I will add some documentation explaining the limitation on SunStudio.
comment:7 by , 11 years ago
| Milestone: | To Be Determined → Boost 1.50.0 |
|---|---|
| Severity: | Showstopper → Problem |
comment:8 by , 10 years ago
| Resolution: | → fixed |
|---|---|
| Status: | assigned → closed |
Committed in release branch at [78543]

Version of compiler: CC: Sun C++ 5.10 SunOS_sparc 2009/06/03