Opened 7 years ago

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


// 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 Changed 7 years ago by anonymous

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

comment:2 Changed 7 years ago by anonymous

Component: Nonethread
Owner: set to Anthony Williams

comment:3 Changed 7 years ago by viboes

Summary: Compile error with SunStudioCompile error with SunStudio: unique_future move

comment:4 Changed 7 years ago by viboes

Cc: viboes 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 Changed 7 years ago by viboes

Owner: changed from Anthony Williams to viboes
Status: newassigned

comment:6 Changed 7 years ago by viboes

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 Changed 7 years ago by viboes

Milestone: To Be DeterminedBoost 1.50.0
Severity: ShowstopperProblem

comment:8 Changed 7 years ago by viboes

Resolution: fixed
Status: assignedclosed

Committed in release branch at [78543]

Note: See TracTickets for help on using tickets.