Boost logo

Boost Users :

From: Pierre THIERRY (nowhere.man_at_[hidden])
Date: 2006-06-19 08:03:41


Hi,

I've just got an error I would think impossible with variant: assigning
another variant to it triggered the false assert at

/usr/include/boost/variant/detail/visitation_impl.hpp:203

which, IIUC, seems to say that there is a lack of a fallback type...

FWIW, it's a variant holding 3 types, an int and 2 pointers types. When
the error occurs, it's in the copy constructor of an object holding such
a variant, and at this moment, the rhs variant holds it's third type,
the second pointer type.

The exact error is, at runtime (compilation goes without a warning):

/usr/include/boost/variant/detail/visitation_impl.hpp:203: typename Visitor::result_type boost::detail::variant::visitation_impl(int, int, Visitor&, VPCV, mpl_::true_, NBF, W*, S*) [with W = mpl_::int_<20>, S = boost::detail::variant::visitation_impl_step<boost::mpl::l_iter<boost::mpl::l_end>, boost::mpl::l_iter<boost::mpl::l_end> >, Visitor = boost::variant<twotypestree::tree_placeholder, twotypestree::tree<T1, T2*>::node_iterator*, twotypestree::tree<T1, T2*>::leaf_iterator*, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_>::assigner, VP
CV = const void*, NBF = boost::variant<twotypestree::tree_placeholder, twotypestree::tree<T1, T2*>::node_iterator*, twotypestree::tree<T1, T2*>::leaf_iterator*, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_>::has_fallback_type_]: Assertion `false' failed.

- twotypestree::tree<T1, T2*> is a tree holding a different data at it's
nodes (T1 here) and it's leafs (T2* here).
- twotypestree::tree_placeholder is an enum with just a value,
  not_a_tree

The code triggering the problem is as simple as:

tree_iterator(const tree_iterator& original)
{
        pimpl_ = original.pimpl_; // pimpl_ is the variant
}

Would anyone see what the problem is?

Confusingly,
Nowhere man

-- 
nowhere.man_at_[hidden]
OpenPGP 0xD9D50D8A

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net