Boost logo

Boost :

From: Alexei Alexandrov (alexei.alexandrov_at_[hidden])
Date: 2006-04-12 13:17:02


JOAQUIN LOPEZ MU?Z <joaquin <at> tid.es> writes:

>
> 1. What is the compiler error you're getting?

> Now, from what you report, seems the restriction is
> being too much comprehensive. Could you test what is the
> value of
>
> boost::is_convertible<
> const name_record::Ptr,
> const name_record
> >::value
>
> on your compiler?

No, this thing compiles and expands to false as expected. In fact, the error
I'm getting is about

boost/boost/type_traits/is_convertible.hpp(254): error: class "name_record" has
no suitable copy constructor
      BOOST_STATIC_CONSTANT(bool, value =
      ^
          detected during:
            instantiation of
class "boost::detail::is_convertible_basic_impl<From, To> [with
From=boost::detail::is_convertible_impl<const name_record, const
name_record>::ref_type, To=const name_record]" at line 286
            instantiation of class "boost::detail::is_convertible_impl<From,
To> [with From=const name_record, To=const name_record]" at line 362
            instantiation of
class "boost::detail::is_convertible_impl_dispatch<From, To> [with From=const
name_record, To=const name_record]" at line 409
            instantiation of class "boost::is_convertible<From, To> [with
From=const name_record, To=const name_record]" at line 59 of "D:\src\3rd-
parties\boost/boost/utility/enable_if.hpp"

and can be reproduced with

    bool br = boost::is_convertible<
        const name_record,
        const name_record
>::value;

It fails to compile as well. It seems that is_convertible doesn't handle
noncopyable target type well. I believe that this is because they use SFINAE
for the check and the try-a-conversion function has the argument by value

template <typename From, typename To>
struct is_convertible_basic_impl
{
    static ::boost::type_traits::no_type BOOST_TT_DECL _m_check(...);
    static ::boost::type_traits::yes_type BOOST_TT_DECL _m_check(To);
    static From _m_from;

and compiler fails to pass the argument by value.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk