Boost C++ Libraries: Ticket #3844: boost.thread doesn't work with gcc-4.5 in c++0x mode https://svn.boost.org/trac10/ticket/3844 <pre class="wiki">$ cat test.cpp #include &lt;boost/thread.hpp&gt; int main() {} $ g++ -v </pre><p> 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-<span class="underline">cxa_atexit --enable-clocale=gnu --enable-lto Thread model: posix gcc version 4.5.0 20100115 (experimental) (GCC) </span></p> <pre class="wiki">$ g++ test.cpp -std=c++0x </pre><p> In file included from /usr/include/boost/thread/thread.hpp:22:0, </p> <blockquote> <p> from /usr/include/boost/thread.hpp:13, from test.cpp:1: </p> </blockquote> <p> /usr/include/boost/thread/detail/thread.hpp: In function 'boost::thread&amp;&amp; boost::move(boost::thread&amp;&amp;)': /usr/include/boost/thread/detail/thread.hpp:349:16: error: invalid initialization of reference of type 'boost::thread&amp;&amp;' from expression of type 'boost::thread' In file included from /usr/include/boost/thread/detail/thread_heap_alloc.hpp:17:0, </p> <blockquote> <p> 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: </p> </blockquote> <p> /usr/include/boost/thread/pthread/thread_heap_alloc.hpp: In function 'T* boost::detail::heap_new(A1&amp;&amp;) [with T = boost::detail::thread_data&lt;void (*)()&gt;, A1 = void (*&amp;)()]': /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 (*&amp;&amp;)()' /usr/include/boost/thread/detail/thread.hpp:43:13: error: initializing argument 1 of 'boost::detail::thread_data&lt;F&gt;::thread_data(F&amp;&amp;) [with F = void (*)()]' In file included from /usr/include/boost/thread/pthread/mutex.hpp:11:0, </p> <blockquote> <p> 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: </p> </blockquote> <p> /usr/include/boost/thread/locks.hpp: In member function 'boost::unique_lock&lt;Mutex&gt;&amp; boost::unique_lock&lt;Mutex&gt;::operator=(boost::unique_lock&lt;Mutex&gt;&amp;&amp;) [with Mutex = boost::mutex, boost::unique_lock&lt;Mutex&gt; = boost::unique_lock&lt;boost::mutex&gt;]': /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&lt;boost::mutex&gt;' lvalue to 'boost::unique_lock&lt;boost::mutex&gt;&amp;&amp;' /usr/include/boost/thread/locks.hpp:279:14: error: initializing argument 1 of 'void boost::unique_lock&lt;Mutex&gt;::swap(boost::unique_lock&lt;Mutex&gt;&amp;&amp;) [with Mutex = boost::mutex, boost::unique_lock&lt;Mutex&gt; = boost::unique_lock&lt;boost::mutex&gt;]' </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/3844 Trac 1.4.3 anonymous Sun, 14 Feb 2010 22:00:41 GMT attachment set https://svn.boost.org/trac10/ticket/3844 https://svn.boost.org/trac10/ticket/3844 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">thread.diff</span> </li> </ul> Ticket trueorca@… Sun, 14 Feb 2010 22:01:17 GMT attachment set https://svn.boost.org/trac10/ticket/3844 https://svn.boost.org/trac10/ticket/3844 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">locks.diff</span> </li> </ul> <p> Egor Dmitrenkov </p> Ticket trueorca@… Sun, 14 Feb 2010 22:02:27 GMT attachment set https://svn.boost.org/trac10/ticket/3844 https://svn.boost.org/trac10/ticket/3844 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">thread_heap_alloc.diff</span> </li> </ul> Ticket Egor Dmitrenkov <trueorca@…> Sun, 14 Feb 2010 22:04:03 GMT <link>https://svn.boost.org/trac10/ticket/3844#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3844#comment:1</guid> <description> <p> attached patches solved the issue for me. </p> </description> <category>Ticket</category> </item> <item> <author>Egor Dmitrenkov <trueorca@…></author> <pubDate>Sun, 14 Feb 2010 22:07:07 GMT</pubDate> <title>component changed https://svn.boost.org/trac10/ticket/3844#comment:2 https://svn.boost.org/trac10/ticket/3844#comment:2 <ul> <li><strong>component</strong> <span class="trac-field-old">threads</span> → <span class="trac-field-new">thread</span> </li> </ul> <p> I guess "threads" conponent of the ticket actually should be "thread". </p> Ticket mlrus@… Wed, 28 Apr 2010 18:19:03 GMT <link>https://svn.boost.org/trac10/ticket/3844#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3844#comment:3</guid> <description> <p> 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 </p> <pre class="wiki"> inline thread&amp;&amp; move(thread&amp;&amp; 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&lt;thread&amp;&amp;&gt;(t) </pre><p> Replying to <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/3844" title="#3844: Patches: boost.thread doesn't work with gcc-4.5 in c++0x mode (closed: fixed)">Sebastian Mingramm &lt;s.mingramm@…&gt;</a>: </p> <blockquote class="citation"> <pre class="wiki">$ cat test.cpp #include &lt;boost/thread.hpp&gt; int main() {} $ g++ -v </pre><p> 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-<span class="underline">cxa_atexit --enable-clocale=gnu --enable-lto Thread model: posix gcc version 4.5.0 20100115 (experimental) (GCC) </span></p> <pre class="wiki">$ g++ test.cpp -std=c++0x </pre><p> In file included from /usr/include/boost/thread/thread.hpp:22:0, </p> <blockquote> <p> from /usr/include/boost/thread.hpp:13, from test.cpp:1: </p> </blockquote> <p> /usr/include/boost/thread/detail/thread.hpp: In function 'boost::thread&amp;&amp; boost::move(boost::thread&amp;&amp;)': /usr/include/boost/thread/detail/thread.hpp:349:16: error: invalid initialization of reference of type 'boost::thread&amp;&amp;' from expression of type 'boost::thread' In file included from /usr/include/boost/thread/detail/thread_heap_alloc.hpp:17:0, </p> <blockquote> <p> 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: </p> </blockquote> <p> /usr/include/boost/thread/pthread/thread_heap_alloc.hpp: In function 'T* boost::detail::heap_new(A1&amp;&amp;) [with T = boost::detail::thread_data&lt;void (*)()&gt;, A1 = void (*&amp;)()]': /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 (*&amp;&amp;)()' /usr/include/boost/thread/detail/thread.hpp:43:13: error: initializing argument 1 of 'boost::detail::thread_data&lt;F&gt;::thread_data(F&amp;&amp;) [with F = void (*)()]' In file included from /usr/include/boost/thread/pthread/mutex.hpp:11:0, </p> <blockquote> <p> 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: </p> </blockquote> <p> /usr/include/boost/thread/locks.hpp: In member function 'boost::unique_lock&lt;Mutex&gt;&amp; boost::unique_lock&lt;Mutex&gt;::operator=(boost::unique_lock&lt;Mutex&gt;&amp;&amp;) [with Mutex = boost::mutex, boost::unique_lock&lt;Mutex&gt; = boost::unique_lock&lt;boost::mutex&gt;]': /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&lt;boost::mutex&gt;' lvalue to 'boost::unique_lock&lt;boost::mutex&gt;&amp;&amp;' /usr/include/boost/thread/locks.hpp:279:14: error: initializing argument 1 of 'void boost::unique_lock&lt;Mutex&gt;::swap(boost::unique_lock&lt;Mutex&gt;&amp;&amp;) [with Mutex = boost::mutex, boost::unique_lock&lt;Mutex&gt; = boost::unique_lock&lt;boost::mutex&gt;]' </p> </blockquote> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Fri, 21 May 2010 15:21:22 GMT</pubDate> <title>type changed https://svn.boost.org/trac10/ticket/3844#comment:4 https://svn.boost.org/trac10/ticket/3844#comment:4 <ul> <li><strong>type</strong> <span class="trac-field-old">Bugs</span> → <span class="trac-field-new">Patches</span> </li> </ul> Ticket anonymous Thu, 10 Jun 2010 07:36:15 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/3844#comment:5 https://svn.boost.org/trac10/ticket/3844#comment:5 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> Already fixed on trunk </p> Ticket