Hi,
Can anyone explain why the following won't compile (using g++ 3.3.2
under Linux):
#include
#include
using namespace std;
struct Foo
{
Foo() {}
template <typename T>
Foo(T const & src,
typename boost::enable_if<
boost::is_convertible, void >::type * dummy = 0)
{
int i = 1; // filler.
}
template <typename T>
Foo(T const & src,
typename boost::disable_if<
boost::is_convertible, void >::type * dummy = 0)
{
int i = 2; // ditto.
}
};
int main()
{
Foo f;
Foo f2(f);
return 0;
};
When I attempt to compile this code with g++ 3.3.2, I get the following
error messages:
/boost/boost/type_traits/is_convertible.hpp: In instantiation of
`boost::disable_if, void>':
/boost/boost/type_traits/is_convertible.hpp:128: instantiated from
`boost::detail::is_convertible_basic_impl'
/boost/boost/type_traits/is_convertible.hpp:228: instantiated from
`boost::detail::is_convertible_impl'
test.cpp:36: instantiated from
`boost::detail::is_convertible_impl_dispatch'
test.cpp:36: instantiated from `boost::is_convertible'
test.cpp:36: instantiated from
`boost::enable_if, void>'
test.cpp:36: instantiated from here
/boost/boost/type_traits/is_convertible.hpp:128: error: `value'
is not a member of type `boost::is_convertible'
/boost/boost/type_traits/is_convertible.hpp: In instantiation of
`boost::detail::is_convertible_basic_impl':
/boost/boost/type_traits/is_convertible.hpp:228: instantiated from
`boost::detail::is_convertible_impl'
test.cpp:36: instantiated from
`boost::detail::is_convertible_impl_dispatch'
test.cpp:36: instantiated from `boost::is_convertible'
test.cpp:36: instantiated from
`boost::enable_if, void>'
test.cpp:36: instantiated from here
/boost/boost/type_traits/is_convertible.hpp:128: error:
initializing argument 1 of `static yes_type
boost::detail::checker<T>::_m_check(T, int) [with T = Foo]'
If I use boost::is_same<> in place of boost::is_convertible<>,
everything is fine. Is there something that I'm missing, or is this a bug?
Thanks in advance,
Tim