[cfe-dev] [libc++] clang / libc++ fail to compile the code with boost

ryuuta ryuuta at gmail.com
Fri Jul 1 19:09:20 PDT 2011


Hi,

I bet the problem is in boost implementation but
I'm not 100% sure whether the issue is really on boost side or not.

Compiling the following code

$ cat boost_thread.cpp

#include <boost/thread.hpp>

int main()
{
  return 0;
}

$ clang++ -stdlib=libc++ ./boost_thread.cpp

In file included from ./boost_thread.cpp:1:
In file included from /usr/include/boost/thread.hpp:24:
In file included from /usr/include/boost/thread/future.hpp:14:
In file included from /usr/include/boost/exception_ptr.hpp:9:
In file included from
/usr/include/boost/exception/detail/exception_ptr.hpp:19:
In file included from /usr/include/boost/exception/info.hpp:15:
In file included from /usr/include/boost/exception/to_string_stub.hpp:15:
In file included from
/usr/include/boost/exception/detail/object_hex_dump.hpp:14:
/usr/include/boost/exception/detail/type_info.hpp:53:9: error: cannot define
the implicit default assignment operator for
      'boost::exception_detail::type_info_', because non-static reference
member 'type_' can't use default assignment operator
        type_info_
        ^
/usr/include/c++/v1/__tree:1244:35: note: in instantiation of member
function 'std::__1::pair<boost::exception_detail::type_info_,
      boost::shared_ptr<boost::exception_detail::error_info_base>
>::operator=' requested here
                __cache->__value_ = *__first;
                                  ^
/usr/include/c++/v1/__tree:1185:9: note: in instantiation of function
template specialization
      'std::__1::__tree<std::__1::pair<boost::exception_detail::type_info_,
boost::shared_ptr<boost::exception_detail::error_info_base> >,
      std::__1::__map_value_compare<boost::exception_detail::type_info_,
boost::shared_ptr<boost::exception_detail::error_info_base>,
      std::__1::less<boost::exception_detail::type_info_>, true>,
std::__1::allocator<std::__1::pair<boost::exception_detail::type_info_,
      boost::shared_ptr<boost::exception_detail::error_info_base> > >

>::__assign_multi<std::__1::__tree_const_iterator<std::__1::pair<boost::exception_detail::type_info_,
      boost::shared_ptr<boost::exception_detail::error_info_base> >, const
std::__1::__tree_node<std::__1::pair<boost::exception_detail::type_info_,
      boost::shared_ptr<boost::exception_detail::error_info_base> >, void *>
*, long> >' requested here
        __assign_multi(__t.begin(), __t.end());
        ^
/usr/include/c++/v1/map:760:21: note: in instantiation of member function
'std::__1::__tree<std::__1::pair<boost::exception_detail::type_info_,
      boost::shared_ptr<boost::exception_detail::error_info_base> >,
std::__1::__map_value_compare<boost::exception_detail::type_info_,
      boost::shared_ptr<boost::exception_detail::error_info_base>,
std::__1::less<boost::exception_detail::type_info_>, true>,

std::__1::allocator<std::__1::pair<boost::exception_detail::type_info_,
boost::shared_ptr<boost::exception_detail::error_info_base> > >
>::operator='
      requested here
            __tree_ = __m.__tree_;
                    ^
/usr/include/boost/exception/info.hpp:160:26: note: in instantiation of
member function 'std::__1::map<boost::exception_detail::type_info_,
      boost::shared_ptr<boost::exception_detail::error_info_base>,
std::__1::less<boost::exception_detail::type_info_>,
      std::__1::allocator<std::__1::pair<const
boost::exception_detail::type_info_,
boost::shared_ptr<boost::exception_detail::error_info_base> > >
      >::operator=' requested here
                c->info_ = info_;
                         ^
/usr/include/boost/exception/detail/type_info.hpp:55:41: note: declared here
            detail::sp_typeinfo const & type_;
                                        ^
/usr/include/c++/v1/utility:247:15: note: implicit default copy assignment
operator for 'boost::exception_detail::type_info_' first required here
        first = __p.first;
              ^
1 error generated.

===================================

Since

$ clang++ -stdlib=libstdc++ ./boost_thread.cpp

has worked perfectly fine my guess is that boost_thread.hpp doesn't strictly
conform to the standard.

Any comment will be appreciated.

Thanks,

Ryuta

p.s.

My boost library is 1.46.1.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110702/2570db39/attachment.html>


More information about the cfe-dev mailing list