Bug or change behavior in Fusion at_c in boost 1.66 and 1.67

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Bug or change behavior in Fusion at_c in boost 1.66 and 1.67

Boost - Dev mailing list
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@localhost boost_bug_test]$
[i-bird@localhost boost_bug_test]$
[i-bird@localhost boost_bug_test]$
[i-bird@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


_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: Bug or change behavior in Fusion at_c in boost 1.66 and 1.67

Boost - Dev mailing list

________________________________________
From: Boost [[hidden email]] on behalf of Pietro Incardona via Boost [[hidden email]]
>Sent: 16 April 2018 21:22
>To: [hidden email]
>Cc: Pietro Incardona
>Subject: [boost] Bug or change behavior in Fusion at_c in boost 1.66 and 1.67

> Dear boost developers

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

<code deleted>

>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

Pietro

You do not say which version of g++ you are using.

I have tried this code with various compilers with Boost 1.66 and C++11 and -O2 optimization

With Clang 4.0 and 6.0 it compiles.

With gcc 7.2 and 5.2 it fails, although they compile with Boost 1.64.

I don't have an explanation for this, I offer it as a clue.

John Fletcher



_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: Bug or change behavior in Fusion at_c in boost 1.66 and 1.67

Boost - Dev mailing list

________________________________________
From: Boost [[hidden email]] on behalf of Fletcher, John P via Boost [[hidden email]]
Sent: 17 April 2018 12:24
To: [hidden email]
Cc: Fletcher, John P
Subject: Re: [boost] Bug or change behavior in Fusion at_c in boost 1.66 and 1.67

________________________________________
From: Boost [[hidden email]] on behalf of Pietro Incardona via Boost [[hidden email]]
>Sent: 16 April 2018 21:22
>To: [hidden email]
>Cc: Pietro Incardona
>Subject: [boost] Bug or change behavior in Fusion at_c in boost 1.66 and 1.67

> Dear boost developers

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

<code deleted>

>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

Pietro

You do not say which version of g++ you are using.

I have tried this code with various compilers with Boost 1.66 and C++11 and -O2 optimization

With Clang 4.0 and 6.0 it compiles.

With gcc 7.2 and 5.2 it fails, although they compile with Boost 1.64.

I don't have an explanation for this, I offer it as a clue.

John Fletcher


P.S.  After some digging around my suspicion is on PR#151 put into 1.66.0

https://www.boost.org/users/history/version_1_66_0.html

John

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: Bug or change behavior in Fusion at_c in boost 1.66 and 1.67

Boost - Dev mailing list
In reply to this post by Boost - Dev mailing list
Hi Pietro,


On 04/17/2018 05:22 AM, Pietro Incardona via Boost wrote:
> I used to use boost vector container with arrays like in the code below
I filed this at https://github.com/boostorg/fusion/issues/176 .

Thanks your report!

Kohei





_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

signature.asc (871 bytes) Download Attachment