Personal.X-Istence.com

Bert JW Regeer (畢傑龍)

Bug in Boost 1.4.7 when compiling with clang and c++0x support

This bug:

http://comments.gmane.org/gmane.comp.compilers.clang.devel/15926

still exists in 1.4.7.

Here is a small example:

#include <boost/thread/thread.hpp>

int main()
{
    return 0;
}

And compile it:

clang++ test.cc
clang++ -std=c++0x test.cc

In file included from test.cc:1:
In file included from /usr/local/include/boost/thread/thread.hpp:17:
/usr/local/include/boost/thread/pthread/thread_data.hpp:36:17: error: call to deleted constructor of 
'boost::shared_ptr<boost::detail::tss_cleanup_function>'
                func(func_),value(value_)
                ^    ~~~~~
/usr/local/include/boost/smart_ptr/shared_ptr.hpp:164:25: 
               note: function has been explicitly marked deleted here
template<class T> class shared_ptr
                        ^
In file included from test.cc:1:
In file included from /usr/local/include/boost/thread/thread.hpp:22:
/usr/local/include/boost/thread/detail/thread.hpp:395:13: error: 
            call to deleted constructor of 'detail::thread_data_ptr' (aka 'shared_ptr<boost::detail::thread_data_base>')
            thread_data(thread_data_)
            ^           ~~~~~~~~~~~~
/usr/local/include/boost/smart_ptr/shared_ptr.hpp:464:36: 
            note: function has been explicitly marked deleted here
    template<class Y> friend class shared_ptr;
                                   ^
/usr/local/include/boost/smart_ptr/shared_ptr.hpp:301:9: error: functional-style cast from 
'const boost::shared_ptr<boost::detail::thread_data_base>' to 'this_type' (aka 'shared_ptr<boost::detail::thread_data_base>') 
uses deleted function
        this_type(r).swap(*this);
        ^~~~~~~~~~~
/usr/local/include/boost/thread/detail/thread.hpp:181:24: note: in instantiation of member function 
'boost::shared_ptr<boost::detail::thread_data_base>::operator=' requested here
            thread_info=other.thread_info;
                       ^
/usr/local/include/boost/smart_ptr/shared_ptr.hpp:464:36: note: candidate constructor (the implicit copy constructor) has 
            been explicitly deleted
    template<class Y> friend class shared_ptr;
                                   ^
/usr/local/include/boost/smart_ptr/shared_ptr.hpp:227:5: note: candidate constructor [with Y = boost::detail::thread_data_base]
    shared_ptr( shared_ptr<Y> const & r, typename boost::detail::sp_enable_if_convertible<Y,T>::type = boost::detail::sp_empty() )
    ^
3 errors generated.