[Boost-bugs] [Boost C++ Libraries] #5146: Assertion fails in visitation_impl.hpp with nested variants

Subject: [Boost-bugs] [Boost C++ Libraries] #5146: Assertion fails in visitation_impl.hpp with nested variants
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-01-31 22:06:59


#5146: Assertion fails in visitation_impl.hpp with nested variants
-----------------------------------------------------+----------------------
 Reporter: Florian Goujeon <flo.goujeon@…> | Owner: ebf
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: variant
  Version: Boost 1.45.0 | Severity: Problem
 Keywords: variant assert assertion nested |
-----------------------------------------------------+----------------------
 Let test_variant be following typedef:
 {{{
 typedef
         variant
         <
                 int,
                 ptr_to_test_variant
>
         test_variant
 ;
 }}}

 ptr_to_test_variant is a simple class which contains a test_variant object
 allocated on the heap (to break the circular dependency, see attachment).

 Here is the test case:
 {{{
 int main()
 {
         test_variant tv1 = 88;
         test_variant ptr_to_tv1 = ptr_to_test_variant(tv1);
         test_variant ptr_to_ptr_to_tv1 = ptr_to_test_variant(ptr_to_tv1);

         const ptr_to_test_variant& direct_ptr_to_ptr_to_tv1 =
 get<ptr_to_test_variant>(ptr_to_ptr_to_tv1);
         ptr_to_ptr_to_tv1 =
 direct_ptr_to_ptr_to_tv1.pointed_test_variant();
 }
 }}}

 Here is the output:
 {{{
 /usr/include/boost/variant/detail/visitation_impl.hpp:207: 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<int,
 ptr_to_test_variant>::convert_copy_into, VPCV = void*, NBF =
 boost::variant<int, ptr_to_test_variant>::has_fallback_type_, typename
 Visitor::result_type = int, mpl_::true_ = mpl_::bool_<true>]: Assertion
 `false' failed.
 }}}

 I'm experiencing the exact same issue with my own implementation of stack-
 based variant (using variadic templates) as well. I'd like to know how to
 fix this…

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/5146>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:05 UTC