Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2003-04-09 08:43:42

The following program fails to compile on every version of GCC I can

foo.cpp:21: instantiated from `boost::is_convertible<foo<const int*>, foo<int*> >'
foo.cpp:21: instantiated from here
foo.cpp:15: invalid conversion from `const int* const' to `int*'

All other compilers I can find accept it. It looks as though
is_convertible is looking beyond the declarations of functions into
their definitions. Commenting out the implementation of foo's
templated constructor makes it compile!

#include <boost/type_traits/is_convertible.hpp>
template <class T>
struct foo
    template <class U>
    foo(foo<U> const& other) : p(other.p) {}
    T p;
int main()
    return boost::is_convertible<foo<int const*>, foo<int*> >::value;
Dave Abrahams
Boost Consulting

Boost list run by bdawes at, gregod at, cpdaniel at, john at