Boost logo

Boost :

Subject: [boost] Bug or change behavior in Fusion at_c in boost 1.66 and 1.67
From: Pietro Incardona (asmprog32_at_[hidden])
Date: 2018-04-16 20:22:51


Dear boost developers

I used to use boost vector container with arrays like in the code below

#include <boost/fusion/sequence/intrinsic/at.hpp>
#include <boost/fusion/include/at.hpp>
#include <boost/fusion/container/vector.hpp>

int main()
{
        boost::fusion::vector<int[3], int, int> v;
        boost::fusion::at_c<1>(v) = 2;
        boost::fusion::at_c<0>(v)[0] = 1; //// <----- Broken on newer boost version
}

Compiled with

g++ --std=c++11 -I/home/i-bird/BOOST_166/include -o out main.cpp

Unfortunately while this code was working under BOOST 1.63, on Boost 1.66 and Boost 1.67 it does not compile and it produce this error below. It seem that include/boost/fusion/container/vector/detail/value_at_impl.hpp went under some "modernization" process that broke the code above

Regards
Pietro

/////////////////////////// Error /////////////////////////////////////////////

In file included from /home/i-bird/BOOST_166/include/boost/fusion/container/vector/detail/at_impl.hpp:12:0,
                 from /home/i-bird/BOOST_166/include/boost/fusion/container/vector/vector.hpp:29,
                 from /home/i-bird/BOOST_166/include/boost/fusion/container/vector.hpp:12,
                 from main.cpp:3:
/home/i-bird/BOOST_166/include/boost/fusion/container/vector/detail/value_at_impl.hpp: In instantiation of ‘struct boost::fusion::extension::value_at_impl<boost::fusion::vector_tag>::apply<boost::fusion::vector<int [3], int, int>, mpl_::int_<0> >’:
/home/i-bird/BOOST_166/include/boost/fusion/container/vector/detail/at_impl.hpp:45:95: required from ‘struct boost::fusion::extension::at_impl<boost::fusion::vector_tag>::apply<const boost::fusion::vector<int [3], int, int>, mpl_::int_<0> >’
/home/i-bird/BOOST_166/include/boost/fusion/sequence/intrinsic/at.hpp:66:16: required from ‘struct boost::fusion::detail::at_impl<const boost::fusion::vector<int [3], int, int>, mpl_::int_<0>, boost::fusion::vector_tag>’
/home/i-bird/BOOST_166/include/boost/fusion/sequence/intrinsic/at.hpp:81:16: required from ‘struct boost::fusion::result_of::at<const boost::fusion::vector<int [3], int, int>, mpl_::int_<0> >’
/home/i-bird/BOOST_166/include/boost/fusion/sequence/intrinsic/at.hpp:86:16: required from ‘struct boost::fusion::result_of::at_c<const boost::fusion::vector<int [3], int, int>, 0>’
/home/i-bird/BOOST_166/include/boost/fusion/sequence/intrinsic/at.hpp:127:5: required by substitution of ‘template<int N, class Sequence> constexpr typename boost::fusion::result_of::at_c<const Sequence, N>::type boost::fusion::at_c(const Sequence&) [with int N = 0; Sequence = boost::fusion::vector<int [3], int, int>]’
main.cpp:9:26: required from here
/home/i-bird/BOOST_166/include/boost/fusion/container/vector/detail/value_at_impl.hpp:53:68: error: no matching function for call to ‘value_at_impl<mpl_::int_<0>::value>(boost::fusion::vector<int [3], int, int>*)’
                     decltype(vector_detail::value_at_impl<N::value>(boost::declval<Sequence*>()))
                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/i-bird/BOOST_166/include/boost/fusion/container/vector/detail/value_at_impl.hpp:38:11: note: candidate: template<long unsigned int N, class U> U boost::fusion::vector_detail::value_at_impl(const volatile boost::fusion::vector_detail::store<N, U>*)
         U value_at_impl(store<N, U> const volatile*);
           ^~~~~~~~~~~~~
/home/i-bird/BOOST_166/include/boost/fusion/container/vector/detail/value_at_impl.hpp:38:11: note: template argument deduction/substitution failed:
/home/i-bird/BOOST_166/include/boost/fusion/container/vector/detail/value_at_impl.hpp:53:68: note: template argument ‘1’ does not match ‘0’
                     decltype(vector_detail::value_at_impl<N::value>(boost::declval<Sequence*>()))
                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/i-bird/BOOST_166/include/boost/fusion/container/vector/detail/value_at_impl.hpp:53:68: note: template argument ‘2’ does not match ‘0’
/home/i-bird/BOOST_166/include/boost/fusion/container/vector/detail/value_at_impl.hpp: In substitution of ‘template<long unsigned int N, class U> U boost::fusion::vector_detail::value_at_impl(const volatile boost::fusion::vector_detail::store<N, U>*) [with long unsigned int N = 0; U = int [3]]’:
/home/i-bird/BOOST_166/include/boost/fusion/container/vector/detail/value_at_impl.hpp:53:68: required from ‘struct boost::fusion::extension::value_at_impl<boost::fusion::vector_tag>::apply<boost::fusion::vector<int [3], int, int>, mpl_::int_<0> >’
/home/i-bird/BOOST_166/include/boost/fusion/container/vector/detail/at_impl.hpp:45:95: required from ‘struct boost::fusion::extension::at_impl<boost::fusion::vector_tag>::apply<const boost::fusion::vector<int [3], int, int>, mpl_::int_<0> >’
/home/i-bird/BOOST_166/include/boost/fusion/sequence/intrinsic/at.hpp:66:16: required from ‘struct boost::fusion::detail::at_impl<const boost::fusion::vector<int [3], int, int>, mpl_::int_<0>, boost::fusion::vector_tag>’
/home/i-bird/BOOST_166/include/boost/fusion/sequence/intrinsic/at.hpp:81:16: required from ‘struct boost::fusion::result_of::at<const boost::fusion::vector<int [3], int, int>, mpl_::int_<0> >’
/home/i-bird/BOOST_166/include/boost/fusion/sequence/intrinsic/at.hpp:86:16: required from ‘struct boost::fusion::result_of::at_c<const boost::fusion::vector<int [3], int, int>, 0>’
/home/i-bird/BOOST_166/include/boost/fusion/sequence/intrinsic/at.hpp:127:5: required by substitution of ‘template<int N, class Sequence> constexpr typename boost::fusion::result_of::at_c<const Sequence, N>::type boost::fusion::at_c(const Sequence&) [with int N = 0; Sequence = boost::fusion::vector<int [3], int, int>]’
main.cpp:9:26: required from here
/home/i-bird/BOOST_166/include/boost/fusion/container/vector/detail/value_at_impl.hpp:38:11: error: function returning an array
         U value_at_impl(store<N, U> const volatile*);
           ^~~~~~~~~~~~~
main.cpp: In function ‘int main()’:
main.cpp:9:26: error: no matching function for call to ‘at_c<0>(boost::fusion::vector<int [3], int, int>&)’
  boost::fusion::at_c<0>(v)[0] = 1;
                          ^
In file included from main.cpp:1:0:
/home/i-bird/BOOST_166/include/boost/fusion/sequence/intrinsic/at.hpp:119:5: note: candidate: template<int N, class Sequence> constexpr typename boost::lazy_disable_if<boost::is_const<Sequence>, boost::fusion::result_of::at_c<Sequence, N> >::type boost::fusion::at_c(Sequence&)
     at_c(Sequence& seq)
     ^~~~
/home/i-bird/BOOST_166/include/boost/fusion/sequence/intrinsic/at.hpp:119:5: note: template argument deduction/substitution failed:
/home/i-bird/BOOST_166/include/boost/fusion/sequence/intrinsic/at.hpp:127:5: note: candidate: template<int N, class Sequence> constexpr typename boost::fusion::result_of::at_c<const Sequence, N>::type boost::fusion::at_c(const Sequence&)
     at_c(Sequence const& seq)
     ^~~~
/home/i-bird/BOOST_166/include/boost/fusion/sequence/intrinsic/at.hpp:127:5: note: substitution of deduced template arguments resulted in errors seen above
[i-bird_at_localhost boost_bug_test]$
[i-bird_at_localhost boost_bug_test]$
[i-bird_at_localhost boost_bug_test]$
[i-bird_at_localhost boost_bug_test]$ g++ --std=c++11 -I/home/i-bird/BOOST_167/include -o out main.cpp
In file included from /home/i-bird/BOOST_167/include/boost/fusion/container/vector/detail/at_impl.hpp:12:0,
                 from /home/i-bird/BOOST_167/include/boost/fusion/container/vector/vector.hpp:29,
                 from /home/i-bird/BOOST_167/include/boost/fusion/container/vector.hpp:12,
                 from main.cpp:3:
/home/i-bird/BOOST_167/include/boost/fusion/container/vector/detail/value_at_impl.hpp: In instantiation of ‘struct boost::fusion::extension::value_at_impl<boost::fusion::vector_tag>::apply<boost::fusion::vector<int [3], int, int>, mpl_::int_<0> >’:
/home/i-bird/BOOST_167/include/boost/fusion/container/vector/detail/at_impl.hpp:45:95: required from ‘struct boost::fusion::extension::at_impl<boost::fusion::vector_tag>::apply<const boost::fusion::vector<int [3], int, int>, mpl_::int_<0> >’
/home/i-bird/BOOST_167/include/boost/fusion/sequence/intrinsic/at.hpp:66:16: required from ‘struct boost::fusion::detail::at_impl<const boost::fusion::vector<int [3], int, int>, mpl_::int_<0>, boost::fusion::vector_tag>’
/home/i-bird/BOOST_167/include/boost/fusion/sequence/intrinsic/at.hpp:81:16: required from ‘struct boost::fusion::result_of::at<const boost::fusion::vector<int [3], int, int>, mpl_::int_<0> >’
/home/i-bird/BOOST_167/include/boost/fusion/sequence/intrinsic/at.hpp:86:16: required from ‘struct boost::fusion::result_of::at_c<const boost::fusion::vector<int [3], int, int>, 0>’
/home/i-bird/BOOST_167/include/boost/fusion/sequence/intrinsic/at.hpp:127:5: required by substitution of ‘template<int N, class Sequence> constexpr typename boost::fusion::result_of::at_c<const Sequence, N>::type boost::fusion::at_c(const Sequence&) [with int N = 0; Sequence = boost::fusion::vector<int [3], int, int>]’
main.cpp:9:26: required from here
/home/i-bird/BOOST_167/include/boost/fusion/container/vector/detail/value_at_impl.hpp:53:68: error: no matching function for call to ‘value_at_impl<mpl_::int_<0>::value>(boost::fusion::vector<int [3], int, int>*)’
                     decltype(vector_detail::value_at_impl<N::value>(boost::declval<Sequence*>()))
                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/i-bird/BOOST_167/include/boost/fusion/container/vector/detail/value_at_impl.hpp:38:11: note: candidate: template<long unsigned int N, class U> U boost::fusion::vector_detail::value_at_impl(const volatile boost::fusion::vector_detail::store<N, U>*)
         U value_at_impl(store<N, U> const volatile*);
           ^~~~~~~~~~~~~
/home/i-bird/BOOST_167/include/boost/fusion/container/vector/detail/value_at_impl.hpp:38:11: note: template argument deduction/substitution failed:
/home/i-bird/BOOST_167/include/boost/fusion/container/vector/detail/value_at_impl.hpp:53:68: note: template argument ‘1’ does not match ‘0’
                     decltype(vector_detail::value_at_impl<N::value>(boost::declval<Sequence*>()))
                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/i-bird/BOOST_167/include/boost/fusion/container/vector/detail/value_at_impl.hpp:53:68: note: template argument ‘2’ does not match ‘0’
/home/i-bird/BOOST_167/include/boost/fusion/container/vector/detail/value_at_impl.hpp: In substitution of ‘template<long unsigned int N, class U> U boost::fusion::vector_detail::value_at_impl(const volatile boost::fusion::vector_detail::store<N, U>*) [with long unsigned int N = 0; U = int [3]]’:
/home/i-bird/BOOST_167/include/boost/fusion/container/vector/detail/value_at_impl.hpp:53:68: required from ‘struct boost::fusion::extension::value_at_impl<boost::fusion::vector_tag>::apply<boost::fusion::vector<int [3], int, int>, mpl_::int_<0> >’
/home/i-bird/BOOST_167/include/boost/fusion/container/vector/detail/at_impl.hpp:45:95: required from ‘struct boost::fusion::extension::at_impl<boost::fusion::vector_tag>::apply<const boost::fusion::vector<int [3], int, int>, mpl_::int_<0> >’
/home/i-bird/BOOST_167/include/boost/fusion/sequence/intrinsic/at.hpp:66:16: required from ‘struct boost::fusion::detail::at_impl<const boost::fusion::vector<int [3], int, int>, mpl_::int_<0>, boost::fusion::vector_tag>’
/home/i-bird/BOOST_167/include/boost/fusion/sequence/intrinsic/at.hpp:81:16: required from ‘struct boost::fusion::result_of::at<const boost::fusion::vector<int [3], int, int>, mpl_::int_<0> >’
/home/i-bird/BOOST_167/include/boost/fusion/sequence/intrinsic/at.hpp:86:16: required from ‘struct boost::fusion::result_of::at_c<const boost::fusion::vector<int [3], int, int>, 0>’
/home/i-bird/BOOST_167/include/boost/fusion/sequence/intrinsic/at.hpp:127:5: required by substitution of ‘template<int N, class Sequence> constexpr typename boost::fusion::result_of::at_c<const Sequence, N>::type boost::fusion::at_c(const Sequence&) [with int N = 0; Sequence = boost::fusion::vector<int [3], int, int>]’
main.cpp:9:26: required from here
/home/i-bird/BOOST_167/include/boost/fusion/container/vector/detail/value_at_impl.hpp:38:11: error: function returning an array
         U value_at_impl(store<N, U> const volatile*);
           ^~~~~~~~~~~~~
main.cpp: In function ‘int main()’:
main.cpp:9:26: error: no matching function for call to ‘at_c<0>(boost::fusion::vector<int [3], int, int>&)’
  boost::fusion::at_c<0>(v)[0] = 1;
                          ^
In file included from main.cpp:1:0:
/home/i-bird/BOOST_167/include/boost/fusion/sequence/intrinsic/at.hpp:119:5: note: candidate: template<int N, class Sequence> constexpr typename boost::lazy_disable_if<boost::is_const<Sequence>, boost::fusion::result_of::at_c<Sequence, N> >::type boost::fusion::at_c(Sequence&)
     at_c(Sequence& seq)
     ^~~~
/home/i-bird/BOOST_167/include/boost/fusion/sequence/intrinsic/at.hpp:119:5: note: template argument deduction/substitution failed:
/home/i-bird/BOOST_167/include/boost/fusion/sequence/intrinsic/at.hpp:127:5: note: candidate: template<int N, class Sequence> constexpr typename boost::fusion::result_of::at_c<const Sequence, N>::type boost::fusion::at_c(const Sequence&)
     at_c(Sequence const& seq)
     ^~~~
/home/i-bird/BOOST_167/include/boost/fusion/sequence/intrinsic/at.hpp:127:5: note: substitution of deduced template arguments resulted in errors seen above


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk