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 anonymous, 11 years ago

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

comment:2 by anonymous, 11 years ago

Component: Nonethread
Owner: set to Anthony Williams

comment:3 by viboes, 11 years ago

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

comment:4 by viboes, 11 years ago

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

Owner: changed from Anthony Williams to viboes
Status: newassigned

comment:6 by viboes, 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 viboes, 11 years ago

Milestone: To Be DeterminedBoost 1.50.0
Severity: ShowstopperProblem

comment:8 by viboes, 10 years ago

Resolution: fixed
Status: assignedclosed

Committed in release branch at [78543]

Note: See TracTickets for help on using tickets.