Opened 13 years ago
Closed 12 years ago
#3844 closed Patches (fixed)
boost.thread doesn't work with gcc-4.5 in c++0x mode
Reported by: | Owned by: | Anthony Williams | |
---|---|---|---|
Milestone: | Boost 1.42.0 | Component: | thread |
Version: | Boost 1.41.0 | Severity: | Problem |
Keywords: | Cc: |
Description
$ cat test.cpp #include <boost/thread.hpp> int main() {} $ g++ -v
Using built-in specs. COLLECT_GCC=g++ COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-pc-linux-gnu/4.5.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ./configure --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --disable-altivec --disable-fixed-point --with-ppl --with-cloog --disable-nls --with-system-zlib --disable-checking --disable-werror --enable-secureplt --enable-multilib --enable-libmudflap --disable-libssp --enable-libgomp --enable-cld --enable-languages=c,c++ --enable-shared --enable-threads=posix --enable-cxa_atexit --enable-clocale=gnu --enable-lto Thread model: posix gcc version 4.5.0 20100115 (experimental) (GCC)
$ g++ test.cpp -std=c++0x
In file included from /usr/include/boost/thread/thread.hpp:22:0,
from /usr/include/boost/thread.hpp:13, from test.cpp:1:
/usr/include/boost/thread/detail/thread.hpp: In function 'boost::thread&& boost::move(boost::thread&&)': /usr/include/boost/thread/detail/thread.hpp:349:16: error: invalid initialization of reference of type 'boost::thread&&' from expression of type 'boost::thread' In file included from /usr/include/boost/thread/detail/thread_heap_alloc.hpp:17:0,
from /usr/include/boost/thread/detail/thread.hpp:13, from /usr/include/boost/thread/thread.hpp:22, from /usr/include/boost/thread.hpp:13, from test.cpp:1:
/usr/include/boost/thread/pthread/thread_heap_alloc.hpp: In function 'T* boost::detail::heap_new(A1&&) [with T = boost::detail::thread_data<void (*)()>, A1 = void (*&)()]': /usr/include/boost/thread/detail/thread.hpp:130:95: instantiated from here /usr/include/boost/thread/pthread/thread_heap_alloc.hpp:24:47: error: cannot bind 'void (*)()' lvalue to 'void (*&&)()' /usr/include/boost/thread/detail/thread.hpp:43:13: error: initializing argument 1 of 'boost::detail::thread_data<F>::thread_data(F&&) [with F = void (*)()]' In file included from /usr/include/boost/thread/pthread/mutex.hpp:11:0,
from /usr/include/boost/thread/mutex.hpp:16, from /usr/include/boost/thread/pthread/thread_data.hpp:12, from /usr/include/boost/thread/thread.hpp:17, from /usr/include/boost/thread.hpp:13, from test.cpp:1:
/usr/include/boost/thread/locks.hpp: In member function 'boost::unique_lock<Mutex>& boost::unique_lock<Mutex>::operator=(boost::unique_lock<Mutex>&&) [with Mutex = boost::mutex, boost::unique_lock<Mutex> = boost::unique_lock<boost::mutex>]': /usr/include/boost/thread/future.hpp:414:91: instantiated from here /usr/include/boost/thread/locks.hpp:269:13: error: cannot bind 'boost::unique_lock<boost::mutex>' lvalue to 'boost::unique_lock<boost::mutex>&&' /usr/include/boost/thread/locks.hpp:279:14: error: initializing argument 1 of 'void boost::unique_lock<Mutex>::swap(boost::unique_lock<Mutex>&&) [with Mutex = boost::mutex, boost::unique_lock<Mutex> = boost::unique_lock<boost::mutex>]'
Attachments (3)
Change History (8)
by , 13 years ago
Attachment: | thread.diff added |
---|
by , 13 years ago
Attachment: | locks.diff added |
---|
by , 13 years ago
Attachment: | thread_heap_alloc.diff added |
---|
comment:2 by , 13 years ago
Component: | threads → thread |
---|
I guess "threads" conponent of the ticket actually should be "thread".
comment:3 by , 12 years ago
Might be a boost bug "In fact it's try to bind the reference to an lvalue, which is invalid" according to Bugzilla Bug 43915
inline thread&& move(thread&& t) { return t; } At the point of return 't' is an lvalue so to return it as an rvalue it needs to be static_cast<thread&&>(t)
Replying to Sebastian Mingramm <s.mingramm@…>:
$ cat test.cpp #include <boost/thread.hpp> int main() {} $ g++ -vUsing built-in specs. COLLECT_GCC=g++ COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-pc-linux-gnu/4.5.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ./configure --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --disable-altivec --disable-fixed-point --with-ppl --with-cloog --disable-nls --with-system-zlib --disable-checking --disable-werror --enable-secureplt --enable-multilib --enable-libmudflap --disable-libssp --enable-libgomp --enable-cld --enable-languages=c,c++ --enable-shared --enable-threads=posix --enable-cxa_atexit --enable-clocale=gnu --enable-lto Thread model: posix gcc version 4.5.0 20100115 (experimental) (GCC)
$ g++ test.cpp -std=c++0xIn file included from /usr/include/boost/thread/thread.hpp:22:0,
from /usr/include/boost/thread.hpp:13, from test.cpp:1:
/usr/include/boost/thread/detail/thread.hpp: In function 'boost::thread&& boost::move(boost::thread&&)': /usr/include/boost/thread/detail/thread.hpp:349:16: error: invalid initialization of reference of type 'boost::thread&&' from expression of type 'boost::thread' In file included from /usr/include/boost/thread/detail/thread_heap_alloc.hpp:17:0,
from /usr/include/boost/thread/detail/thread.hpp:13, from /usr/include/boost/thread/thread.hpp:22, from /usr/include/boost/thread.hpp:13, from test.cpp:1:
/usr/include/boost/thread/pthread/thread_heap_alloc.hpp: In function 'T* boost::detail::heap_new(A1&&) [with T = boost::detail::thread_data<void (*)()>, A1 = void (*&)()]': /usr/include/boost/thread/detail/thread.hpp:130:95: instantiated from here /usr/include/boost/thread/pthread/thread_heap_alloc.hpp:24:47: error: cannot bind 'void (*)()' lvalue to 'void (*&&)()' /usr/include/boost/thread/detail/thread.hpp:43:13: error: initializing argument 1 of 'boost::detail::thread_data<F>::thread_data(F&&) [with F = void (*)()]' In file included from /usr/include/boost/thread/pthread/mutex.hpp:11:0,
from /usr/include/boost/thread/mutex.hpp:16, from /usr/include/boost/thread/pthread/thread_data.hpp:12, from /usr/include/boost/thread/thread.hpp:17, from /usr/include/boost/thread.hpp:13, from test.cpp:1:
/usr/include/boost/thread/locks.hpp: In member function 'boost::unique_lock<Mutex>& boost::unique_lock<Mutex>::operator=(boost::unique_lock<Mutex>&&) [with Mutex = boost::mutex, boost::unique_lock<Mutex> = boost::unique_lock<boost::mutex>]': /usr/include/boost/thread/future.hpp:414:91: instantiated from here /usr/include/boost/thread/locks.hpp:269:13: error: cannot bind 'boost::unique_lock<boost::mutex>' lvalue to 'boost::unique_lock<boost::mutex>&&' /usr/include/boost/thread/locks.hpp:279:14: error: initializing argument 1 of 'void boost::unique_lock<Mutex>::swap(boost::unique_lock<Mutex>&&) [with Mutex = boost::mutex, boost::unique_lock<Mutex> = boost::unique_lock<boost::mutex>]'
comment:4 by , 12 years ago
Type: | Bugs → Patches |
---|
Egor Dmitrenkov