Hello,
The following code fails to compile when using GCC 4.4.6 and boost::optional from Boost 1.49:
#include
#include
struct grill
{
template<typename U>
grill (U)
{}
};
template<typename T>
struct bar
{
template<typename U>
bar (U,
typename boost::is_convertible::type* = 0)
{}
};
void foo()
{
typedef bar<grill> data_type;
boost::optional opt;
boost::optional opt2(opt); // this line
(void)opt2;
}
Here are the error messages (I apologize for the long lines, I shortened them as much as possible by truncating the header paths):
type_traits/is_convertible.hpp: In instantiation of ‘const bool boost::detail::is_convertible_basic_impl&, grill>::value’:
type_traits/is_convertible.hpp:329: instantiated from ‘const bool boost::detail::is_convertible_impl, grill>::value’
type_traits/is_convertible.hpp:452: instantiated from ‘boost::is_convertible, grill>’
optional/optional.hpp:604: instantiated from ‘boost::optional<T>::optional(const boost::optional<T>&) [with T = bar<grill>]’
optional.cpp:25: instantiated from here
optional/optional.hpp:285: error: ‘boost::optional_detail::optional_base<T>::optional_base(const boost::optional_detail::optional_base<T>&) [with T = bar<grill>]’ is protected
type_traits/is_convertible.hpp:170: error: within this context
type_traits/is_convertible.hpp:170: error: initializing argument 1 of ‘grill::grill(U) [with U = boost::optional_detail::optional_base]’
optional/optional.hpp:308: error: ‘boost::optional_detail::optional_base<T>::~optional_base() [with T = bar<grill>]’ is protected
type_traits/is_convertible.hpp:170: error: within this context
This reproduction case is distilled from a real world example (not my code) where bar=boost::fusion::vector1 and grill=boost::function
The code compiles fine using the same compiler and Boost 1.44.
Any ideas on the root of the problem?
Thanks in advance!
Jon