[Proto] Error in FoldToList Example of Tutorial
Dear all, When I compile the FoldToList example defined here in Proto tutorial: http://boost.org/doc/libs/1_45_0/doc/html/proto/users_guide.html#boost_proto... I get some compiler error message in GCC 4.5.1 (MinGW32, WinXP, SP3), Boost 1.42.0. For your reference, I have included the error messages in the P.S. section of this posting. Anyone here knows what's going wrong? TIA,--Hossein P.S. -------------- Build: Debug in Fold2List --------------- Compiling: main.cpp In file included from D:\Sources\Boost\boost_1_42_0/boost/fusion/view/ext_/segmented_iterator.hpp:23:0, from D:\Sources\Boost\boost_1_42_0/boost/proto/fusion.hpp:28, from D:\Sources\Boost\boost_1_42_0/boost/proto/core.hpp:21, from D:\Sources\Boost\boost_1_42_0/boost/proto/proto.hpp:12, from D:\My Documents\My Programmes\Tutorial\Proto\Fold2List\main.cpp:2: D:\Sources\Boost\boost_1_42_0/boost/fusion/container/list/cons.hpp: In instantiation of 'boost::fusion::cons<boost::proto::_value, boost::proto::_state>': D:\Sources\Boost\boost_1_42_0/boost/mpl/aux_/preprocessed/gcc/template_arity.hpp:85:5: instantiated from 'const int boost::mpl::aux::template_arity_impl<boost::fusion::cons<boost::proto::_value, boost::proto::_state>, 1>::value' D:\Sources\Boost\boost_1_42_0/boost/mpl/aux_/preprocessed/gcc/template_arity.hpp:93:5: instantiated from 'const int boost::mpl::aux::template_arity<boost::fusion::cons<boost::proto::_value, boost::proto::_state> >::value' D:\Sources\Boost\boost_1_42_0/boost/mpl/aux_/preprocessed/gcc/template_arity.hpp:98:30: instantiated from 'boost::mpl::aux::template_arity<boost::fusion::cons<boost::proto::_value, boost::proto::_state> >' D:\Sources\Boost\boost_1_42_0/boost/proto/traits.hpp:104:9: instantiated from 'boost::proto::is_callable<boost::fusion::cons<boost::proto::_value, boost::proto::_state> >' D:\Sources\Boost\boost_1_42_0/boost/proto/transform/when.hpp:156:17: instantiated from 'boost::proto::when<boost::proto::op::terminal<boost::proto::wildcardns_::_>, boost::fusion::cons<boost::proto::_value, boost::proto::_state>(boost::proto::_value, boost::proto::_state)>::impl<const boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<const char&>, 0l>&, const boost::fusion::nil&, int>' D:\Sources\Boost\boost_1_42_0/boost/proto/matches.hpp:753:17: [ skipping 4 instantiation contexts ] D:\Sources\Boost\boost_1_42_0/boost/proto/transform/call.hpp:232:93: instantiated from 'boost::proto::call<FoldToList(boost::proto::_child_c<0>, FoldToList (*)(boost::proto::_child_c<1>, boost::proto::_state))>::impl2<const boost::proto::exprns_::expr<boost::proto::tag::shift_left, boost::proto::argsns_::list2<const boost::proto::exprns_::expr<boost::proto::tag::shift_left, boost::proto::argsns_::list2<const boost::proto::exprns_::expr<boost::proto::tag::shift_left, boost::proto::argsns_::list2<const boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<std::basic_ostream<char>&>, 0l>&, boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<const int&>, 0l> >, 2l>&, boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<const double&>, 0l> >, 2l>&, boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<const char&>, 0l> >, 2l>&, const boost::fusion::nil&, int, true>' D:\Sources\Boost\boost_1_42_0/boost/proto/transform/call.hpp:276:13: instantiated from 'boost::proto::call<FoldToList(boost::proto::_child_c<0>, FoldToList (*)(boost::proto::_child_c<1>, boost::proto::_state))>::impl<const boost::proto::exprns_::expr<boost::proto::tag::shift_left, boost::proto::argsns_::list2<const boost::proto::exprns_::expr<boost::proto::tag::shift_left, boost::proto::argsns_::list2<const boost::proto::exprns_::expr<boost::proto::tag::shift_left, boost::proto::argsns_::list2<const boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<std::basic_ostream<char>&>, 0l>&, boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<const int&>, 0l> >, 2l>&, boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<const double&>, 0l> >, 2l>&, boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<const char&>, 0l> >, 2l>&, const boost::fusion::nil&, int>' D:\Sources\Boost\boost_1_42_0/boost/proto/transform/when.hpp:158:87: instantiated from 'boost::proto::when<boost::proto::op::shift_left<FoldToList, FoldToList>, FoldToList(boost::proto::_child_c<0>, FoldToList (*)(boost::proto::_child_c<1>, boost::proto::_state))>::impl<const boost::proto::exprns_::expr<boost::proto::tag::shift_left, boost::proto::argsns_::list2<const boost::proto::exprns_::expr<boost::proto::tag::shift_left, boost::proto::argsns_::list2<const boost::proto::exprns_::expr<boost::proto::tag::shift_left, boost::proto::argsns_::list2<const boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<std::basic_ostream<char>&>, 0l>&, boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<const int&>, 0l> >, 2l>&, boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<const double&>, 0l> >, 2l>&, boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<const char&>, 0l> >, 2l>&, const boost::fusion::nil&, int>' D:\Sources\Boost\boost_1_42_0/boost/proto/matches.hpp:753:17: instantiated from 'boost::proto::control::or_<boost::proto::when<boost::proto::op::terminal<std::basic_ostream<char>&>, boost::proto::_state>, boost::proto::when<boost::proto::op::terminal<boost::proto::wildcardns_::_>, boost::fusion::cons<boost::proto::_value, boost::proto::_state>(boost::proto::_value, boost::proto::_state)>, boost::proto::when<boost::proto::op::shift_left<FoldToList, FoldToList>, FoldToList(boost::proto::_child_c<0>, FoldToList (*)(boost::proto::_child_c<1>, boost::proto::_state))> >::impl<const boost::proto::exprns_::expr<boost::proto::tag::shift_left, boost::proto::argsns_::list2<const boost::proto::exprns_::expr<boost::proto::tag::shift_left, boost::proto::argsns_::list2<const boost::proto::exprns_::expr<boost::proto::tag::shift_left, boost::proto::argsns_::list2<const boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<std::basic_ostream<char>&>, 0l>&, boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<const int&>, 0l> >, 2l>&, boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<const double&>, 0l> >, 2l>&, boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<const char&>, 0l> >, 2l>&, const boost::fusion::nil&, int>' D:\Sources\Boost\boost_1_42_0/boost/proto/transform/impl.hpp:85:9: instantiated from 'boost::proto::detail::apply_transform<boost::proto::control::or_<boost::proto::when<boost::proto::op::terminal<std::basic_ostream<char>&>, boost::proto::_state>, boost::proto::when<boost::proto::op::terminal<boost::proto::wildcardns_::_>, boost::fusion::cons<boost::proto::_value, boost::proto::_state>(boost::proto::_value, boost::proto::_state)>, boost::proto::when<boost::proto::op::shift_left<FoldToList, FoldToList>, FoldToList(boost::proto::_child_c<0>, FoldToList (*)(boost::proto::_child_c<1>, boost::proto::_state))> >(const boost::proto::exprns_::expr<boost::proto::tag::shift_left, boost::proto::argsns_::list2<const boost::proto::exprns_::expr<boost::proto::tag::shift_left, boost::proto::argsns_::list2<const boost::proto::exprns_::expr<boost::proto::tag::shift_left, boost::proto::argsns_::list2<const boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<std::basic_ostream<char>&>, 0l>&, boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<const int&>, 0l> >, 2l>&, boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<const double&>, 0l> >, 2l>&, boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<const char&>, 0l> >, 2l>&, const boost::fusion::nil&)>' D:\My Documents\My Programmes\Tutorial\Proto\Fold2List\main.cpp:81:70: instantiated from here D:\Sources\Boost\boost_1_42_0/boost/fusion/container/list/cons.hpp:61:47: error: no type named 'size' in 'struct boost::proto::_state' Process terminated with status 1 (0 minutes, 2 seconds) 2 errors, 0 warnings
... Just wanted to add that the same problem occurs when I try the piece of code in the documentation of Boost 1.42: http://boost.org/doc/libs/1_42_0/doc/html/proto/users_guide.html#boost_proto... --- On Fri, 24/12/10, Hossein Haeri <powerprogman@yahoo.com> wrote: From: Hossein Haeri <powerprogman@yahoo.com> Subject: [Boost-users] [Proto] Error in FoldToList Example of Tutorial To: boost-users@lists.boost.org Date: Friday, 24 December, 2010, 17:13 Dear all, When I compile the FoldToList example defined here in Proto tutorial: http://boost.org/doc/libs/1_45_0/doc/html/proto/users_guide.html#boost_proto... I get some compiler error message in GCC 4.5.1 (MinGW32, WinXP, SP3), Boost 1.42.0. For your reference, I have included the error messages in the P.S. section of this posting. Anyone here knows what's going wrong? TIA,--Hossein P.S. -------------- Build: Debug in Fold2List --------------- Compiling: main.cpp In file included from D:\Sources\Boost\boost_1_42_0/boost/fusion/view/ext_/segmented_iterator.hpp:23:0, from D:\Sources\Boost\boost_1_42_0/boost/proto/fusion.hpp:28, from D:\Sources\Boost\boost_1_42_0/boost/proto/core.hpp:21, from D:\Sources\Boost\boost_1_42_0/boost/proto/proto.hpp:12, from D:\My Documents\My Programmes\Tutorial\Proto\Fold2List\main.cpp:2: D:\Sources\Boost\boost_1_42_0/boost/fusion/container/list/cons.hpp: In instantiation of 'boost::fusion::cons<boost::proto::_value, boost::proto::_state>': D:\Sources\Boost\boost_1_42_0/boost/mpl/aux_/preprocessed/gcc/template_arity.hpp:85:5: instantiated from 'const int boost::mpl::aux::template_arity_impl<boost::fusion::cons<boost::proto::_value, boost::proto::_state>, 1>::value' D:\Sources\Boost\boost_1_42_0/boost/mpl/aux_/preprocessed/gcc/template_arity.hpp:93:5: instantiated from 'const int boost::mpl::aux::template_arity<boost::fusion::cons<boost::proto::_value, boost::proto::_state> >::value' D:\Sources\Boost\boost_1_42_0/boost/mpl/aux_/preprocessed/gcc/template_arity.hpp:98:30: instantiated from 'boost::mpl::aux::template_arity<boost::fusion::cons<boost::proto::_value, boost::proto::_state> >' D:\Sources\Boost\boost_1_42_0/boost/proto/traits.hpp:104:9: instantiated from 'boost::proto::is_callable<boost::fusion::cons<boost::proto::_value, boost::proto::_state> >' D:\Sources\Boost\boost_1_42_0/boost/proto/transform/when.hpp:156:17: instantiated from 'boost::proto::when<boost::proto::op::terminal<boost::proto::wildcardns_::_>, boost::fusion::cons<boost::proto::_value, boost::proto::_state>(boost::proto::_value, boost::proto::_state)>::impl<const boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<const char&>, 0l>&, const boost::fusion::nil&, int>' D:\Sources\Boost\boost_1_42_0/boost/proto/matches.hpp:753:17: [ skipping 4 instantiation contexts ] D:\Sources\Boost\boost_1_42_0/boost/proto/transform/call.hpp:232:93: instantiated from 'boost::proto::call<FoldToList(boost::proto::_child_c<0>, FoldToList (*)(boost::proto::_child_c<1>, boost::proto::_state))>::impl2<const boost::proto::exprns_::expr<boost::proto::tag::shift_left, boost::proto::argsns_::list2<const boost::proto::exprns_::expr<boost::proto::tag::shift_left, boost::proto::argsns_::list2<const boost::proto::exprns_::expr<boost::proto::tag::shift_left, boost::proto::argsns_::list2<const boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<std::basic_ostream<char>&>, 0l>&, boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<const int&>, 0l> >, 2l>&, boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<const double&>, 0l> >, 2l>&, boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<const char&>, 0l> >, 2l>&, const boost::fusion::nil&, int, true>' D:\Sources\Boost\boost_1_42_0/boost/proto/transform/call.hpp:276:13: instantiated from 'boost::proto::call<FoldToList(boost::proto::_child_c<0>, FoldToList (*)(boost::proto::_child_c<1>, boost::proto::_state))>::impl<const boost::proto::exprns_::expr<boost::proto::tag::shift_left, boost::proto::argsns_::list2<const boost::proto::exprns_::expr<boost::proto::tag::shift_left, boost::proto::argsns_::list2<const boost::proto::exprns_::expr<boost::proto::tag::shift_left, boost::proto::argsns_::list2<const boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<std::basic_ostream<char>&>, 0l>&, boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<const int&>, 0l> >, 2l>&, boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<const double&>, 0l> >, 2l>&, boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<const char&>, 0l> >, 2l>&, const boost::fusion::nil&, int>' D:\Sources\Boost\boost_1_42_0/boost/proto/transform/when.hpp:158:87: instantiated from 'boost::proto::when<boost::proto::op::shift_left<FoldToList, FoldToList>, FoldToList(boost::proto::_child_c<0>, FoldToList (*)(boost::proto::_child_c<1>, boost::proto::_state))>::impl<const boost::proto::exprns_::expr<boost::proto::tag::shift_left, boost::proto::argsns_::list2<const boost::proto::exprns_::expr<boost::proto::tag::shift_left, boost::proto::argsns_::list2<const boost::proto::exprns_::expr<boost::proto::tag::shift_left, boost::proto::argsns_::list2<const boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<std::basic_ostream<char>&>, 0l>&, boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<const int&>, 0l> >, 2l>&, boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<const double&>, 0l> >, 2l>&, boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<const char&>, 0l> >, 2l>&, const boost::fusion::nil&, int>' D:\Sources\Boost\boost_1_42_0/boost/proto/matches.hpp:753:17: instantiated from 'boost::proto::control::or_<boost::proto::when<boost::proto::op::terminal<std::basic_ostream<char>&>, boost::proto::_state>, boost::proto::when<boost::proto::op::terminal<boost::proto::wildcardns_::_>, boost::fusion::cons<boost::proto::_value, boost::proto::_state>(boost::proto::_value, boost::proto::_state)>, boost::proto::when<boost::proto::op::shift_left<FoldToList, FoldToList>, FoldToList(boost::proto::_child_c<0>, FoldToList (*)(boost::proto::_child_c<1>, boost::proto::_state))> >::impl<const boost::proto::exprns_::expr<boost::proto::tag::shift_left, boost::proto::argsns_::list2<const boost::proto::exprns_::expr<boost::proto::tag::shift_left, boost::proto::argsns_::list2<const boost::proto::exprns_::expr<boost::proto::tag::shift_left, boost::proto::argsns_::list2<const boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<std::basic_ostream<char>&>, 0l>&, boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<const int&>, 0l> >, 2l>&, boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<const double&>, 0l> >, 2l>&, boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<const char&>, 0l> >, 2l>&, const boost::fusion::nil&, int>' D:\Sources\Boost\boost_1_42_0/boost/proto/transform/impl.hpp:85:9: instantiated from 'boost::proto::detail::apply_transform<boost::proto::control::or_<boost::proto::when<boost::proto::op::terminal<std::basic_ostream<char>&>, boost::proto::_state>, boost::proto::when<boost::proto::op::terminal<boost::proto::wildcardns_::_>, boost::fusion::cons<boost::proto::_value, boost::proto::_state>(boost::proto::_value, boost::proto::_state)>, boost::proto::when<boost::proto::op::shift_left<FoldToList, FoldToList>, FoldToList(boost::proto::_child_c<0>, FoldToList (*)(boost::proto::_child_c<1>, boost::proto::_state))> >(const boost::proto::exprns_::expr<boost::proto::tag::shift_left, boost::proto::argsns_::list2<const boost::proto::exprns_::expr<boost::proto::tag::shift_left, boost::proto::argsns_::list2<const boost::proto::exprns_::expr<boost::proto::tag::shift_left, boost::proto::argsns_::list2<const boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<std::basic_ostream<char>&>, 0l>&, boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<const int&>, 0l> >, 2l>&, boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<const double&>, 0l> >, 2l>&, boost::proto::exprns_::expr<boost::proto::tag::terminal, boost::proto::argsns_::term<const char&>, 0l> >, 2l>&, const boost::fusion::nil&)>' D:\My Documents\My Programmes\Tutorial\Proto\Fold2List\main.cpp:81:70: instantiated from here D:\Sources\Boost\boost_1_42_0/boost/fusion/container/list/cons.hpp:61:47: error: no type named 'size' in 'struct boost::proto::_state' Process terminated with status 1 (0 minutes, 2 seconds) 2 errors, 0 warnings -----Inline Attachment Follows----- _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
On 12/24/2010 12:13 PM, Hossein Haeri wrote:
Dear all,
When I compile the FoldToList example defined here in Proto tutorial:
http://boost.org/doc/libs/1_45_0/doc/html/proto/users_guide.html#boost_proto...
I get some compiler error message in GCC 4.5.1 (MinGW32, WinXP, SP3), Boost 1.42.0. For your reference, I have included the error messages in the P.S. section of this posting. Anyone here knows what's going wrong?
Hi Hossein, I can confirm the error you're seeing for gcc 4.5 and Boost 1.42. It works on trunk, however. I'm not sure about more recent Boost releases. -- Eric Niebler BoostPro Computing http://www.boostpro.com
Hi Eric, Thank you for confirming the error. But, more than having it confirmed, I was looking for what's going wrong there. Especially, how do I demystify the error message? What is it saying basically? Merry Christmas, BTW! :) TIA,--Hossein --- On Sat, 25/12/10, Eric Niebler <eric@boostpro.com> wrote: From: Eric Niebler <eric@boostpro.com> Subject: Re: [Boost-users] [Proto] Error in FoldToList Example of Tutorial To: boost-users@lists.boost.org Date: Saturday, 25 December, 2010, 1:42 On 12/24/2010 12:13 PM, Hossein Haeri wrote:
Dear all,
When I compile the FoldToList example defined here in Proto tutorial:
http://boost.org/doc/libs/1_45_0/doc/html/proto/users_guide.html#boost_proto...
I get some compiler error message in GCC 4.5.1 (MinGW32, WinXP, SP3), Boost 1.42.0. For your reference, I have included the error messages in the P.S. section of this posting. Anyone here knows what's going wrong?
Hi Hossein, I can confirm the error you're seeing for gcc 4.5 and Boost 1.42. It works on trunk, however. I'm not sure about more recent Boost releases. -- Eric Niebler BoostPro Computing http://www.boostpro.com _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
On 12/25/2010 6:39 AM, Hossein Haeri wrote:
Hi Eric,
Thank you for confirming the error. But, more than having it confirmed, I was looking for what's going wrong there. Especially, how do I demystify the error message? What is it saying basically?
Merry Christmas, BTW! :)
If you look at line 61 of cons.hpp, you see this: template <typename Car, typename Cdr = nil> struct cons : sequence_base<cons<Car, Cdr> > { typedef mpl::int_<Cdr::size::value+1> size; --------------------------^^^^^^^^^ If you instantiate cons with boost::proto::_state as the Cdr parameter, you'll get the error you saw because _state doesn't have a nested "size" type. So somehow, Proto is instantiating cons prematurely, or else Proto's evaluation engine failed to replace _state with the right thing before instantiating cons. It's either a Proto bug that got fixed sometime between then and now, or else a compiler bug that has been worked around. Probably the former. Merry Christmas! -- Eric Niebler BoostPro Computing http://www.boostpro.com
participants (2)
-
Eric Niebler
-
Hossein Haeri