Opened 6 years ago

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

Attachments (0)

Change History (8)

comment:1 Changed 6 years ago by anonymous

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

comment:2 Changed 6 years ago by anonymous

  • Component changed from None to thread
  • Owner set to anthonyw

comment:3 Changed 6 years ago by viboes

  • Summary changed from Compile error with SunStudio to Compile error with SunStudio: unique_future move

comment:4 Changed 6 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 5 years ago by viboes

  • Owner changed from anthonyw to viboes
  • Status changed from new to assigned

comment:6 Changed 5 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 5 years ago by viboes

  • Milestone changed from To Be Determined to Boost 1.50.0
  • Severity changed from Showstopper to Problem

comment:8 Changed 5 years ago by viboes

  • Resolution set to fixed
  • Status changed from assigned to closed

Committed in release branch at [78543]

Add Comment

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain viboes.
The resolution will be deleted. Next status will be 'reopened'.

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.