Opened 9 years ago

Closed 13 months ago

#8721 closed Bugs (worksforme)

Boost.Variant and Boost.Fusion incompatibility

Reported by: David Sankel <camior@…> Owned by: ebf
Milestone: To Be Determined Component: variant
Version: Boost 1.53.0 Severity: Problem
Keywords: Cc:

Description

#include <boost/variant.hpp>
#include <boost/fusion/include/vector.hpp>

struct emptyList {};

typedef boost::make_recursive_variant
  < emptyList
  , boost::fusion::vector
      < int
      , boost::recursive_variant_
      >
  >::type IntList;

const emptyList el = emptyList();
const IntList nil( el );

IntList cons( int head, IntList tail )
{
  return IntList( boost::fusion::vector<int, IntList>( head, tail ) );
}

Change History (3)

comment:1 by David Sankel <camior@…>, 9 years ago

I have a suspicion that the problem may have something to do with BOOST_VARIANT_RECURSIVE_VARIANT_MAX_ARITY.

I've confirmed the issue on both clang cvs and gcc 4.8.1.

comment:2 by David Sankel <camior@…>, 9 years ago

Using std::tuple (From gcc 4.8.1) or boost::tuple instead also produces errors.

comment:3 by Antony Polukhin, 13 months ago

Resolution: worksforme
Status: newclosed

The example now works on modern versions of Boost in C++11 and more modern C++ Standards: https://godbolt.org/z/4o1acx1o8

Added a test case to make sure that the code keeps compiling: https://github.com/boostorg/variant/commit/445d790b2fe81b1b3d413d2fd464fe78712d535f

I'm not planning to work on C++03 support for that case, but would be happy to review Pull Request.

Note: See TracTickets for help on using tickets.