Opened 14 years ago

Closed 13 years ago

#2602 closed Bugs (fixed)

Error, inaccessible: boost::thread::thread(boost::thread&) is not accessible from ...

Reported by: Roberto Gimenez <chilabot@…> Owned by: Anthony Williams
Milestone: Boost 1.38.0 Component: thread
Version: Boost 1.37.0 Severity: Problem
Keywords: Cc: jwakely.boost@…

Description

Error while compiling boost 1.37 libraries in Sun Solaris 10. Here's the Sun Studio Forums post:

http://forums.sun.com/thread.jspa?messageID=10502674#10502674

Attachments (2)

boost_thread_move.patch (444 bytes ) - added by Jonathan Wakely <jwakely.boost@…> 14 years ago.
partial fix for move semantics with Sun compiler
thread.patch (1.8 KB ) - added by Steven Watanabe 13 years ago.

Download all attachments as: .zip

Change History (6)

comment:1 by Jonathan Wakely <jwakely.boost@…>, 14 years ago

Cc: jwakely.boost@… added

This is still present in 1.38.0_beta2

I managed to work around (patch follows) but now test_move_function.cpp fails with similar errors, because some of the tests hit the same bug (failure to implicitly convert to thread_move_t and back)

sun.compile.c++ ../../../bin.v2/libs/thread/test/test_move_function_lib.test/sun-5.9/debug/threading-multi/test_move_function.o
"test_move_function.cpp", line 38: Error, inaccessible: boost::thread::thread(boost::thread&) is not accessible from start_thread().
"test_move_function.cpp", line 43: Error, inaccessible: boost::thread::thread(boost::thread&) is not accessible from test_thread_move_from_rvalue_on_construction().
"test_move_function.cpp", line 62: Error, inaccessible: boost::unique_lock<boost::mutex>::unique_lock(boost::unique_lock<boost::mutex>&) is not accessible from test_unique_lock_move_from_lvalue_on_construction().
"test_move_function.cpp", line 71: Error, inaccessible: boost::unique_lock<boost::mutex>::unique_lock(boost::unique_lock<boost::mutex>&) is not accessible from get_lock(boost::mutex&).
"test_move_function.cpp", line 78: Error, inaccessible: boost::unique_lock<boost::mutex>::unique_lock(boost::unique_lock<boost::mutex>&) is not accessible from test_unique_lock_move_from_rvalue_on_construction().
5 Error(s) detected.

by Jonathan Wakely <jwakely.boost@…>, 14 years ago

Attachment: boost_thread_move.patch added

partial fix for move semantics with Sun compiler

comment:2 by Jonathan Wakely <jwakely.boost@…>, 14 years ago

IMHO the patch is an improvement, as it allows explicit moves from lvalues, even though it doesn't help with implicit moves from rvalues (because you can't create a boost::thread rvalue with the Sun compiler.)

Looking into the unique_lock test failures (which don't cause a failure when building libboost_thread because there's no locks.cpp) I tried to find boost::move() for unique_lock, but it seems to only be defined in when BOOST_HAS_RVALUE_REFS, is that right?

#ifdef BOOST_HAS_RVALUE_REFS
    template<typename Mutex>
    inline unique_lock<Mutex>&& move(unique_lock<Mutex>&& ul)
    {
        return ul;
    }
#endif

Should there be a #else ?

by Steven Watanabe, 13 years ago

Attachment: thread.patch added

comment:3 by Steven Watanabe, 13 years ago

The compiler doesn't seem to actually call the constructor. As far as I can tell, it just requires it to exist. So, there seem to be two options, we can get a compile time error when copying a non-const thread, and a link error when copying a const thread or vice-versa. The attached patch, thread.patch, takes the alternative of making copying a non-const thread a compile time error. All the tests pass for me.

bash-3.2.$ CC -V
CC: Sin C++ 5.9 SunOS_i386 2007/11/15

comment:4 by Anthony Williams, 13 years ago

Resolution: fixed
Status: newclosed

Fixed on trunk (revision 53385)

Note: See TracTickets for help on using tickets.