boost::variant in RTT::OutputPort

Hello.

I'm currently porting some Orocos 1.12.1 component code to 2.6. In the
original component we had a BufferPort with a variant type. This let us
pass multiple types through the same port. However when porting the
component to orocos 2.6 really strange (and long) compilation errors arise.
I've been scratching my head for a while now and I can't figure out what's
wrong with my code.

I managed to reproduce the error in a very simple test component. (See
attachment)

#ifndef OROCOS_VARIANTTEST_COMPONENT_HPP
#define OROCOS_VARIANTTEST_COMPONENT_HPP

#include <string>
#include <boost/variant/variant.hpp>
#include <rtt/RTT.hpp>

class VariantTest : public RTT::TaskContext{

public:
VariantTest(std::string const& name)
: RTT::TaskContext(name)
, _myPort()
{ }

private:
typedef boost::variant<int, std::string> MyVariant;
RTT::OutputPort<MyVariant> _myPort;
};
#endif

This throws the following compilation error... brace youselves! (Also
attached)

>In file included from
/home/jordanpalacios/oroComps/variantTest/src/variantTest-component.hpp:6:0,
from
/home/jordanpalacios/oroComps/variantTest/src/variantTest-component.cpp:1:
/usr/include/boost/variant/variant.hpp: In member function ‘void
boost::variant<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
T14, T15, T16, T17, T18, T19>::convert_construct(T&, int, mpl_::false_)
[with T = const RTT::internal::RStore<boost::variant<int,
std::basic_string<char> > >, T0_ = int, T1 = std::basic_string<char>, T2 =
boost::detail::variant::void_, T3 = boost::detail::variant::void_, T4 =
boost::detail::variant::void_, T5 = boost::detail::variant::void_, T6 =
boost::detail::variant::void_, T7 = boost::detail::variant::void_, T8 =
boost::detail::variant::void_, T9 = boost::detail::variant::void_, T10 =
boost::detail::variant::void_, T11 = boost::detail::variant::void_, T12 =
boost::detail::variant::void_, T13 = boost::detail::variant::void_, T14 =
boost::detail::variant::void_, T15 = boost::detail::variant::void_, T16 =
boost::detail::variant::void_, T17 = boost::detail::variant::void_, T18 =
boost::detail::variant::void_, T19 = boost::detail::variant::void_,
mpl_::false_ = mpl_::bool_<false>]’:
/usr/include/boost/variant/variant.hpp:1373:9: instantiated from
‘boost::variant<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
T14, T15, T16, T17, T18, T19>::variant(const T&) [with T =
RTT::internal::RStore<boost::variant<int, std::basic_string<char> > >, T0_
= int, T1 = std::basic_string<char>, T2 = boost::detail::variant::void_, T3
= boost::detail::variant::void_, T4 = boost::detail::variant::void_, T5 =
boost::detail::variant::void_, T6 = boost::detail::variant::void_, T7 =
boost::detail::variant::void_, T8 = boost::detail::variant::void_, T9 =
boost::detail::variant::void_, T10 = boost::detail::variant::void_, T11 =
boost::detail::variant::void_, T12 = boost::detail::variant::void_, T13 =
boost::detail::variant::void_, T14 = boost::detail::variant::void_, T15 =
boost::detail::variant::void_, T16 = boost::detail::variant::void_, T17 =
boost::detail::variant::void_, T18 = boost::detail::variant::void_, T19 =
boost::detail::variant::void_]’
/usr/include/boost/variant/variant.hpp:1616:29: instantiated from ‘void
boost::variant<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
T14, T15, T16, T17, T18, T19>::assign(const T&) [with T =
RTT::internal::RStore<boost::variant<int, std::basic_string<char> > >, T0_
= int, T1 = std::basic_string<char>, T2 = boost::detail::variant::void_, T3
= boost::detail::variant::void_, T4 = boost::detail::variant::void_, T5 =
boost::detail::variant::void_, T6 = boost::detail::variant::void_, T7 =
boost::detail::variant::void_, T8 = boost::detail::variant::void_, T9 =
boost::detail::variant::void_, T10 = boost::detail::variant::void_, T11 =
boost::detail::variant::void_, T12 = boost::detail::variant::void_, T13 =
boost::detail::variant::void_, T14 = boost::detail::variant::void_, T15 =
boost::detail::variant::void_, T16 = boost::detail::variant::void_, T17 =
boost::detail::variant::void_, T18 = boost::detail::variant::void_, T19 =
boost::detail::variant::void_]’
/usr/include/boost/variant/variant.hpp:1626:9: instantiated from
‘boost::variant<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
T14, T15, T16, T17, T18, T19>& boost::variant<T0, T1, T2, T3, T4, T5, T6,
T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18,
T19>::operator=(const T&) [with T =
RTT::internal::RStore<boost::variant<int, std::basic_string<char> > >, T0_
= int, T1 = std::basic_string<char>, T2 = boost::detail::variant::void_, T3
= boost::detail::variant::void_, T4 = boost::detail::variant::void_, T5 =
boost::detail::variant::void_, T6 = boost::detail::variant::void_, T7 =
boost::detail::variant::void_, T8 = boost::detail::variant::void_, T9 =
boost::detail::variant::void_, T10 = boost::detail::variant::void_, T11 =
boost::detail::variant::void_, T12 = boost::detail::variant::void_, T13 =
boost::detail::variant::void_, T14 = boost::detail::variant::void_, T15 =
boost::detail::variant::void_, T16 = boost::detail::variant::void_, T17 =
boost::detail::variant::void_, T18 = boost::detail::variant::void_, T19 =
boost::detail::variant::void_, boost::variant<T0, T1, T2, T3, T4, T5, T6,
T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19> =
boost::variant<int, std::basic_string<char> >]’
/usr/include/boost/fusion/container/vector/detail/vector_n.hpp:127:1:
instantiated from ‘typename
boost::disable_if<boost::is_convertible<Sequence, T0>,
boost::fusion::vector1<T0>&>::type
boost::fusion::vector1<T0>::operator=(const Sequence&) [with Sequence =
boost::fusion::filter_view<const
boost::fusion::vector<RTT::internal::RStore<boost::variant<int,
std::basic_string<char> > >&, boost::fusion::void_, boost::fusion::void_,
boost::fusion::void_, boost::fusion::void_, boost::fusion::void_,
boost::fusion::void_, boost::fusion::void_, boost::fusion::void_,
boost::fusion::void_>,
RTT::internal::is_arg_return<boost::remove_reference<mpl_::arg<-0x00000000000000001>
> > >, T0 = boost::variant<int, std::basic_string<char> >&, typename
boost::disable_if<boost::is_convertible<Sequence, T0>,
boost::fusion::vector1<T0>&>::type =
boost::fusion::vector1<boost::variant<int, std::basic_string<char> >&>&]’
/usr/include/boost/fusion/container/vector/vector.hpp:86:13: instantiated
from ‘boost::fusion::vector<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>&
boost::fusion::vector<T0, T1, T2, T3, T4, T5, T6, T7, T8,
T9>::operator=(const T&) [with T = boost::fusion::filter_view<const
boost::fusion::vector<RTT::internal::RStore<boost::variant<int,
std::basic_string<char> > >&, boost::fusion::void_, boost::fusion::void_,
boost::fusion::void_, boost::fusion::void_, boost::fusion::void_,
boost::fusion::void_, boost::fusion::void_, boost::fusion::void_,
boost::fusion::void_>,
RTT::internal::is_arg_return<boost::remove_reference<mpl_::arg<-0x00000000000000001>
> > >, T0 = boost::variant<int, std::basic_string<char> >&, T1 =
boost::fusion::void_, T2 = boost::fusion::void_, T3 = boost::fusion::void_,
T4 = boost::fusion::void_, T5 = boost::fusion::void_, T6 =
boost::fusion::void_, T7 = boost::fusion::void_, T8 = boost::fusion::void_,
T9 = boost::fusion::void_, boost::fusion::vector<T0, T1, T2, T3, T4, T5,
T6, T7, T8, T9> = boost::fusion::vector<boost::variant<int,
std::basic_string<char> >&, boost::fusion::void_, boost::fusion::void_,
boost::fusion::void_, boost::fusion::void_, boost::fusion::void_,
boost::fusion::void_, boost::fusion::void_, boost::fusion::void_,
boost::fusion::void_>]’
/opt/orocos/install/include/rtt/internal/../internal/LocalOperationCaller.hpp:224:21:
instantiated from ‘RTT::SendStatus
RTT::internal::LocalOperationCallerImpl<FunctionT>::collectIfDone_impl(T1&)
[with T1 = boost::variant<int, std::basic_string<char> >, FunctionT =
boost::variant<int, std::basic_string<char> >()]’
/opt/orocos/install/include/rtt/internal/../internal/Collect.hpp:116:55:
instantiated from ‘RTT::SendStatus RTT::internal::CollectImpl<1, Ft,
BaseImpl>::collectIfDone(RTT::internal::CollectImpl<1, Ft,
BaseImpl>::arg1_type) [with Ft = boost::variant<int,
std::basic_string<char> >(boost::variant<int, std::basic_string<char> >&),
BaseImpl = RTT::internal::LocalOperationCallerImpl<boost::variant<int,
std::basic_string<char> >()>, RTT::internal::CollectImpl<1, Ft,
BaseImpl>::arg1_type = boost::variant<int, std::basic_string<char> >&]’
/home/jordanpalacios/oroComps/variantTest/src/variantTest-component.cpp:16:1:
instantiated from here
/usr/include/boost/variant/variant.hpp:1300:9: error: no matching function
for call to
‘boost::detail::variant::make_initializer_node::apply<boost::mpl::pair<boost::detail::variant::initializer_root,
mpl_::int_<0> >, boost::mpl::l_iter<boost::mpl::list2<int,
std::basic_string<char> > > >::initializer_node::initialize(void*, const
RTT::internal::RStore<boost::variant<int, std::basic_string<char> > >&)’
/usr/include/boost/variant/detail/initializer.hpp:89:24: note: candidates
are: static int
boost::detail::variant::make_initializer_node::apply<BaseIndexPair,
Iterator>::initializer_node::initialize(void*,
boost::detail::variant::make_initializer_node::apply<BaseIndexPair,
Iterator>::initializer_node::param_T) [with BaseIndexPair =
boost::mpl::pair<boost::detail::variant::make_initializer_node::apply<boost::mpl::pair<boost::detail::variant::initializer_root,
mpl_::int_<0> >, boost::mpl::l_iter<boost::mpl::list2<int,
std::basic_string<char> > > >::initializer_node, mpl_::int_<1> >, Iterator
= boost::mpl::l_iter<boost::mpl::list1<std::basic_string<char> > >,
boost::detail::variant::make_initializer_node::apply<BaseIndexPair,
Iterator>::initializer_node::param_T = const std::basic_string<char>&]
/usr/include/boost/variant/detail/initializer.hpp:122:17: note:
static void boost::detail::variant::initializer_root::initialize()
/usr/include/boost/variant/detail/initializer.hpp:89:24: note:
static int
boost::detail::variant::make_initializer_node::apply<BaseIndexPair,
Iterator>::initializer_node::initialize(void*,
boost::detail::variant::make_initializer_node::apply<BaseIndexPair,
Iterator>::initializer_node::param_T) [with BaseIndexPair =
boost::mpl::pair<boost::detail::variant::initializer_root, mpl_::int_<0> >,
Iterator = boost::mpl::l_iter<boost::mpl::list2<int,
std::basic_string<char> > >,
boost::detail::variant::make_initializer_node::apply<BaseIndexPair,
Iterator>::initializer_node::param_T = const int]
/usr/include/boost/variant/variant.hpp: In member function ‘void
boost::variant<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
T14, T15, T16, T17, T18, T19>::convert_construct(T&, int, mpl_::false_)
[with T = const RTT::internal::AStore<boost::variant<int,
std::basic_string<char> >&>, T0_ = int, T1 = std::basic_string<char>, T2 =
boost::detail::variant::void_, T3 = boost::detail::variant::void_, T4 =
boost::detail::variant::void_, T5 = boost::detail::variant::void_, T6 =
boost::detail::variant::void_, T7 = boost::detail::variant::void_, T8 =
boost::detail::variant::void_, T9 = boost::detail::variant::void_, T10 =
boost::detail::variant::void_, T11 = boost::detail::variant::void_, T12 =
boost::detail::variant::void_, T13 = boost::detail::variant::void_, T14 =
boost::detail::variant::void_, T15 = boost::detail::variant::void_, T16 =
boost::detail::variant::void_, T17 = boost::detail::variant::void_, T18 =
boost::detail::variant::void_, T19 = boost::detail::variant::void_,
mpl_::false_ = mpl_::bool_<false>]’:
/usr/include/boost/variant/variant.hpp:1373:9: instantiated from
‘boost::variant<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
T14, T15, T16, T17, T18, T19>::variant(const T&) [with T =
RTT::internal::AStore<boost::variant<int, std::basic_string<char> >&>, T0_
= int, T1 = std::basic_string<char>, T2 = boost::detail::variant::void_, T3
= boost::detail::variant::void_, T4 = boost::detail::variant::void_, T5 =
boost::detail::variant::void_, T6 = boost::detail::variant::void_, T7 =
boost::detail::variant::void_, T8 = boost::detail::variant::void_, T9 =
boost::detail::variant::void_, T10 = boost::detail::variant::void_, T11 =
boost::detail::variant::void_, T12 = boost::detail::variant::void_, T13 =
boost::detail::variant::void_, T14 = boost::detail::variant::void_, T15 =
boost::detail::variant::void_, T16 = boost::detail::variant::void_, T17 =
boost::detail::variant::void_, T18 = boost::detail::variant::void_, T19 =
boost::detail::variant::void_]’
/usr/include/boost/variant/variant.hpp:1616:29: instantiated from ‘void
boost::variant<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
T14, T15, T16, T17, T18, T19>::assign(const T&) [with T =
RTT::internal::AStore<boost::variant<int, std::basic_string<char> >&>, T0_
= int, T1 = std::basic_string<char>, T2 = boost::detail::variant::void_, T3
= boost::detail::variant::void_, T4 = boost::detail::variant::void_, T5 =
boost::detail::variant::void_, T6 = boost::detail::variant::void_, T7 =
boost::detail::variant::void_, T8 = boost::detail::variant::void_, T9 =
boost::detail::variant::void_, T10 = boost::detail::variant::void_, T11 =
boost::detail::variant::void_, T12 = boost::detail::variant::void_, T13 =
boost::detail::variant::void_, T14 = boost::detail::variant::void_, T15 =
boost::detail::variant::void_, T16 = boost::detail::variant::void_, T17 =
boost::detail::variant::void_, T18 = boost::detail::variant::void_, T19 =
boost::detail::variant::void_]’
/usr/include/boost/variant/variant.hpp:1626:9: instantiated from
‘boost::variant<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
T14, T15, T16, T17, T18, T19>& boost::variant<T0, T1, T2, T3, T4, T5, T6,
T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18,
T19>::operator=(const T&) [with T =
RTT::internal::AStore<boost::variant<int, std::basic_string<char> >&>, T0_
= int, T1 = std::basic_string<char>, T2 = boost::detail::variant::void_, T3
= boost::detail::variant::void_, T4 = boost::detail::variant::void_, T5 =
boost::detail::variant::void_, T6 = boost::detail::variant::void_, T7 =
boost::detail::variant::void_, T8 = boost::detail::variant::void_, T9 =
boost::detail::variant::void_, T10 = boost::detail::variant::void_, T11 =
boost::detail::variant::void_, T12 = boost::detail::variant::void_, T13 =
boost::detail::variant::void_, T14 = boost::detail::variant::void_, T15 =
boost::detail::variant::void_, T16 = boost::detail::variant::void_, T17 =
boost::detail::variant::void_, T18 = boost::detail::variant::void_, T19 =
boost::detail::variant::void_, boost::variant<T0, T1, T2, T3, T4, T5, T6,
T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19> =
boost::variant<int, std::basic_string<char> >]’
/usr/include/boost/fusion/container/vector/detail/vector_n.hpp:127:1:
instantiated from ‘typename
boost::disable_if<boost::is_convertible<Sequence, T0>,
boost::fusion::vector1<T0>&>::type
boost::fusion::vector1<T0>::operator=(const Sequence&) [with Sequence =
boost::fusion::filter_view<const
boost::fusion::vector<RTT::internal::RStore<RTT::FlowStatus>&,
RTT::internal::AStore<boost::variant<int, std::basic_string<char> >&>&,
boost::fusion::void_, boost::fusion::void_, boost::fusion::void_,
boost::fusion::void_, boost::fusion::void_, boost::fusion::void_,
boost::fusion::void_, boost::fusion::void_>,
RTT::internal::is_out_arg<boost::remove_reference<mpl_::arg<-0x00000000000000001>
> > >, T0 = boost::variant<int, std::basic_string<char> >&, typename
boost::disable_if<boost::is_convertible<Sequence, T0>,
boost::fusion::vector1<T0>&>::type =
boost::fusion::vector1<boost::variant<int, std::basic_string<char> >&>&]’
/opt/orocos/install/include/rtt/internal/../internal/LocalOperationCaller.hpp:513:21:
instantiated from
‘RTT::internal::LocalOperationCallerImpl<FunctionT>::result_type
RTT::internal::LocalOperationCallerImpl<FunctionT>::ret_impl(T1) [with T1 =
boost::variant<int, std::basic_string<char> >&, FunctionT =
RTT::FlowStatus(boost::variant<int, std::basic_string<char> >&),
RTT::internal::LocalOperationCallerImpl<FunctionT>::result_type =
RTT::FlowStatus]’
/opt/orocos/install/include/rtt/internal/../internal/Invoker.hpp:100:67:
instantiated from ‘RTT::internal::InvokerImpl<1, F, BaseImpl>::result_type
RTT::internal::InvokerImpl<1, F,
BaseImpl>::ret(RTT::internal::InvokerImpl<1, F, BaseImpl>::arg1_type) [with
F = RTT::FlowStatus(boost::variant<int, std::basic_string<char> >&),
BaseImpl =
RTT::internal::LocalOperationCallerImpl<RTT::FlowStatus(boost::variant<int,
std::basic_string<char> >&)>, RTT::internal::InvokerImpl<1, F,
BaseImpl>::result_type = RTT::FlowStatus, RTT::internal::InvokerImpl<1, F,
BaseImpl>::arg1_type = boost::variant<int, std::basic_string<char> >&]’
/home/jordanpalacios/oroComps/variantTest/src/variantTest-component.cpp:16:1:
instantiated from here
/usr/include/boost/variant/variant.hpp:1300:9: error: no matching function
for call to
‘boost::detail::variant::make_initializer_node::apply<boost::mpl::pair<boost::detail::variant::initializer_root,
mpl_::int_<0> >, boost::mpl::l_iter<boost::mpl::list2<int,
std::basic_string<char> > > >::initializer_node::initialize(void*, const
RTT::internal::AStore<boost::variant<int, std::basic_string<char> >&>&)’
/usr/include/boost/variant/detail/initializer.hpp:89:24: note: candidates
are: static int
boost::detail::variant::make_initializer_node::apply<BaseIndexPair,
Iterator>::initializer_node::initialize(void*,
boost::detail::variant::make_initializer_node::apply<BaseIndexPair,
Iterator>::initializer_node::param_T) [with BaseIndexPair =
boost::mpl::pair<boost::detail::variant::make_initializer_node::apply<boost::mpl::pair<boost::detail::variant::initializer_root,
mpl_::int_<0> >, boost::mpl::l_iter<boost::mpl::list2<int,
std::basic_string<char> > > >::initializer_node, mpl_::int_<1> >, Iterator
= boost::mpl::l_iter<boost::mpl::list1<std::basic_string<char> > >,
boost::detail::variant::make_initializer_node::apply<BaseIndexPair,
Iterator>::initializer_node::param_T = const std::basic_string<char>&]
/usr/include/boost/variant/detail/initializer.hpp:122:17: note:
static void boost::detail::variant::initializer_root::initialize()
/usr/include/boost/variant/detail/initializer.hpp:89:24: note:
static int
boost::detail::variant::make_initializer_node::apply<BaseIndexPair,
Iterator>::initializer_node::initialize(void*,
boost::detail::variant::make_initializer_node::apply<BaseIndexPair,
Iterator>::initializer_node::param_T) [with BaseIndexPair =
boost::mpl::pair<boost::detail::variant::initializer_root, mpl_::int_<0> >,
Iterator = boost::mpl::l_iter<boost::mpl::list2<int,
std::basic_string<char> > >,
boost::detail::variant::make_initializer_node::apply<BaseIndexPair,
Iterator>::initializer_node::param_T = const int]

Any help will be appreciated. Thanks for you time.

Jordán.

AttachmentSize
image001.png10.15 KB
compilation-dump.txt17.48 KB
variantTest-component.hpp445 bytes