
I recently attempted to update to gcc 4.7 and code that compiled with 4.5.3 broke. It appears that boost::fusion expects boost::fusion::random_access_traversal_tag to implicitly cast to mpl::bool_<false>. Switching the 3rd argument from mpl::bool_<false> to an extra template arg (that was ignored), seems to fix the compilation errors. Compiled with std=c++11 /usr/local/include/boost/fusion/algorithm/iteration/for_each.hpp:32:9: error: no matching function for call to 'for_each(boost::fusion::vector2<double, double>&, const mace::rpc::detail::unpack_sequence<mace::rpc::function_filter<mace::rpc::connection<mace::rpc::json::io> > >&, boost::fusion::detail::fusion_category_of<boost::fusion::vector2<double, double> >::type)' /usr/local/include/boost/fusion/algorithm/iteration/for_each.hpp:32:9: note: candidate is: In file included from /usr/local/include/boost/fusion/algorithm/iteration/for_each.hpp:11:0, from /usr/local/include/boost/fusion/algorithm/iteration.hpp:12, from /usr/local/include/boost/fusion/algorithm.hpp:10, from /Users/dlarimer/projects/mace/libs/rpc/include/mace/rpc/json/io.hpp:13, from /Users/dlarimer/projects/mace/libs/rpc/include/mace/rpc/json/tcp/server.hpp:4, from /Users/dlarimer/projects/mace/libs/rpc/examples/json_tcps.cpp:1: /usr/local/include/boost/fusion/algorithm/iteration/detail/for_each.hpp:130:5: note: template<class Sequence, class F> void boost::fusion::detail::for_each(Sequence&, const F&, mpl_::false_) /usr/local/include/boost/fusion/algorithm/iteration/detail/for_each.hpp:130:5: note: template argument deduction/substitution failed: In file included from /usr/local/include/boost/fusion/algorithm/iteration.hpp:12:0, from /usr/local/include/boost/fusion/algorithm.hpp:10, from /Users/dlarimer/projects/mace/libs/rpc/include/mace/rpc/json/io.hpp:13, from /Users/dlarimer/projects/mace/libs/rpc/include/mace/rpc/json/tcp/server.hpp:4, from /Users/dlarimer/projects/mace/libs/rpc/examples/json_tcps.cpp:1: /usr/local/include/boost/fusion/algorithm/iteration/for_each.hpp:32:9: note: cannot convert 'boost::fusion::detail::fusion_category_of<boost::fusion::vector2<double, double> >::type()' (type 'boost::fusion::detail::fusion_category_of<boost::fusion::vector2<double, double> >::type {aka boost::fusion::random_access_traversal_tag}') to type 'mpl_::false_ {aka mpl_::bool_<false>}'

On 6/20/2012 1:37 PM, Daniel Larimer wrote:
I recently attempted to update to gcc 4.7 and code that compiled with 4.5.3 broke.
It appears that boost::fusion expects boost::fusion::random_access_traversal_tag to implicitly cast to mpl::bool_<false>.
Switching the 3rd argument from mpl::bool_<false> to an extra template arg (that was ignored), seems to fix the compilation errors.
Compiled with std=c++11
Do you have a minimal test case? Regards, -- Joel de Guzman http://www.boostpro.com http://boost-spirit.com

On Jun 20, 2012, at 7:36 PM, Joel de Guzman wrote:
On 6/20/2012 1:37 PM, Daniel Larimer wrote:
I recently attempted to update to gcc 4.7 and code that compiled with 4.5.3 broke.
It appears that boost::fusion expects boost::fusion::random_access_traversal_tag to implicitly cast to mpl::bool_<false>.
Switching the 3rd argument from mpl::bool_<false> to an extra template arg (that was ignored), seems to fix the compilation errors.
Compiled with std=c++11
Do you have a minimal test case?
#include <boost/fusion/container/vector.hpp> #include <boost/fusion/algorithm.hpp> #include <boost/fusion/include/make_vector.hpp> struct visitor { template<typename T> void operator()( T t )const{} }; int main() { visitor v; boost::fusion::for_each( boost::fusion::make_vector(5,6.6), v ); return 0; }
Regards, -- Joel de Guzman http://www.boostpro.com http://boost-spirit.com
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

On Jun 20, 2012, at 9:57 PM, Daniel Larimer wrote:
On Jun 20, 2012, at 7:36 PM, Joel de Guzman wrote:
On 6/20/2012 1:37 PM, Daniel Larimer wrote:
I recently attempted to update to gcc 4.7 and code that compiled with 4.5.3 broke.
It appears that boost::fusion expects boost::fusion::random_access_traversal_tag to implicitly cast to mpl::bool_<false>.
Switching the 3rd argument from mpl::bool_<false> to an extra template arg (that was ignored), seems to fix the compilation errors.
Compiled with std=c++11
Do you have a minimal test case?
#include <boost/fusion/container/vector.hpp> #include <boost/fusion/algorithm.hpp> #include <boost/fusion/include/make_vector.hpp>
struct visitor { template<typename T> void operator()( T t )const{} };
int main() { visitor v; boost::fusion::for_each( boost::fusion::make_vector(5,6.6), v ); return 0; }
I could get things to compile by editing boost/fusion/algorithm/iteration/detail/for_each.hpp and changing the last parameter to Ty. It appears that parameter was ignored anyway and that we didn't care about the type. template <typename Sequence, typename F, typename Ty> inline void for_each(Sequence& seq, F const& f, Ty) // unsegmented implementation { detail::for_each_dispatch(seq, f, typename traits::category_of<Sequence>::type()); }
Regards, -- Joel de Guzman http://www.boostpro.com http://boost-spirit.com
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

On 6/21/2012 10:00 AM, Daniel Larimer wrote:
On Jun 20, 2012, at 9:57 PM, Daniel Larimer wrote:
On Jun 20, 2012, at 7:36 PM, Joel de Guzman wrote:
On 6/20/2012 1:37 PM, Daniel Larimer wrote:
I recently attempted to update to gcc 4.7 and code that compiled with 4.5.3 broke.
It appears that boost::fusion expects boost::fusion::random_access_traversal_tag to implicitly cast to mpl::bool_<false>.
Switching the 3rd argument from mpl::bool_<false> to an extra template arg (that was ignored), seems to fix the compilation errors.
Compiled with std=c++11
Do you have a minimal test case?
#include<boost/fusion/container/vector.hpp> #include<boost/fusion/algorithm.hpp> #include<boost/fusion/include/make_vector.hpp>
struct visitor { template<typename T> void operator()( T t )const{} };
int main() { visitor v; boost::fusion::for_each( boost::fusion::make_vector(5,6.6), v ); return 0; }
I could get things to compile by editing boost/fusion/algorithm/iteration/detail/for_each.hpp and changing the last parameter to Ty. It appears that parameter was ignored anyway and that we didn't care about the type.
template<typename Sequence, typename F, typename Ty> inline void for_each(Sequence& seq, F const& f, Ty) // unsegmented implementation { detail::for_each_dispatch(seq, f, typename traits::category_of<Sequence>::type()); }
No, that is not a proper fix. It just bypasses the problem, which seems to be a gcc 4.7 problem. There is nothing wrong with Fusion code AFAICT. Fusion does not expect boost::fusion::random_access_traversal_tag to be converted to an mpl::bool_<false>. That function (detail::for_each) is called this way: detail::for_each(seq, f, typename traits::is_segmented<Sequence>::type()); And there is nothing wrong with that code AFAICT. Sorry, I do not have gcc 4.7 ATM, but at any rate, what errors do you get with the code above. Both VC10 and gcc-4.6 compiles it just fine. Your previous error report is very suspicious: /usr/local/include/boost/fusion/algorithm/iteration/for_each.hpp:32:9: error: no matching function for call to 'for_each(boost::fusion::vector2< double, double>&, const mace::rpc::detail::unpack_sequence<mace::rpc:: function_filter<mace::rpc::connection<mace::rpc::json::io> > >&, boost::fusion::detail::fusion_category_of<boost::fusion::vector2< double, double> >::type)' Fusion never calls for_each with fusion_category_of. It calls for_each_dispatch, (not for_each) with fusion_category_of as third parameter. I don't know how that happened. Regards, -- Joel de Guzman http://www.boostpro.com http://boost-spirit.com

On 06/21/12 01:33, Joel de Guzman wrote:
On 6/21/2012 10:00 AM, Daniel Larimer wrote:
On Jun 20, 2012, at 9:57 PM, Daniel Larimer wrote:
On Jun 20, 2012, at 7:36 PM, Joel de Guzman wrote:
On 6/20/2012 1:37 PM, Daniel Larimer wrote:
I recently attempted to update to gcc 4.7 and code that compiled with 4.5.3 broke.
It appears that boost::fusion expects boost::fusion::random_access_traversal_tag to implicitly cast to mpl::bool_<false>.
Switching the 3rd argument from mpl::bool_<false> to an extra template arg (that was ignored), seems to fix the compilation errors.
Compiled with std=c++11
Do you have a minimal test case?
#include<boost/fusion/container/vector.hpp> #include<boost/fusion/algorithm.hpp> #include<boost/fusion/include/make_vector.hpp>
struct visitor { template<typename T> void operator()( T t )const{} };
int main() { visitor v; boost::fusion::for_each( boost::fusion::make_vector(5,6.6), v ); return 0; }
I could get things to compile by editing boost/fusion/algorithm/iteration/detail/for_each.hpp and changing the last parameter to Ty. It appears that parameter was ignored anyway and that we didn't care about the type.
template<typename Sequence, typename F, typename Ty> inline void for_each(Sequence& seq, F const& f, Ty) // unsegmented implementation { detail::for_each_dispatch(seq, f, typename traits::category_of<Sequence>::type()); }
No, that is not a proper fix. It just bypasses the problem, which seems to be a gcc 4.7 problem. There is nothing wrong with Fusion code AFAICT. Fusion does not expect boost::fusion::random_access_traversal_tag to be converted to an mpl::bool_<false>. That function (detail::for_each) is called this way:
detail::for_each(seq, f, typename traits::is_segmented<Sequence>::type());
And there is nothing wrong with that code AFAICT.
Sorry, I do not have gcc 4.7 ATM, but at any rate, what errors do you get with the code above. Both VC10 and gcc-4.6 compiles it just fine. The code compiles & runs OK with 4.7 as it was on 20120204 on ubuntu:
make -Wfor_each_rand_access_tag.cpp run install -d `dirname for_each_rand_access_tag.o` /home/evansl/download/gcc/4.7-20120204/install/bin/g++ -c -Wall -Wstrict-overflow -ftemplate-depth-300 -O0 -std=gnu++11 -I/home/evansl/prog_dev/boost-svn/ro/boost_1_49_0 -DTEMPLATE_DEPTH=300 for_each_rand_access_tag.cpp -MMD -o for_each_rand_access_tag.o sed -e 's#^for_each_rand_access_tag.o:#for_each_rand_access_tag.o:#' ./for_each_rand_access_tag.d> ./for_each_rand_access_tag.o.dep #rm ./for_each_rand_access_tag.d /home/evansl/download/gcc/4.7-20120204/install/bin/g++ -L/home/evansl/download/gcc/4.7-20120204/install/lib64 -Wl,-rpath -Wl,/home/evansl/download/gcc/4.7-20120204/install/lib64 -llapack -lblas -lgfortran ./for_each_rand_access_tag.o -o for_each_rand_access_tag.exe ./for_each_rand_access_tag.exe Compilation finished at Thu Jun 21 04:51:54

On 06/21/2012 08:33 AM, Joel de Guzman wrote:
No, that is not a proper fix. It just bypasses the problem, which seems to be a gcc 4.7 problem.
GCC 4.7 is known to implement strict name lookup, unlike many compilers. If something breaks with GCC 4.7, it's a sign that the code wasn't standard-compliant, even if it worked with many other compilers before.

On 6/25/2012 12:30 AM, Mathias Gaunard wrote:
On 06/21/2012 08:33 AM, Joel de Guzman wrote:
No, that is not a proper fix. It just bypasses the problem, which seems to be a gcc 4.7 problem.
GCC 4.7 is known to implement strict name lookup, unlike many compilers.
If something breaks with GCC 4.7, it's a sign that the code wasn't standard-compliant, even if it worked with many other compilers before.
I am aware of that. But in this particular case, I can't see any problem with the code. Can you? Did you try the test code the OP attached? Regards, -- Joel de Guzman http://www.boostpro.com http://boost-spirit.com

On 6/20/2012 1:37 PM, Daniel Larimer wrote:
I recently attempted to update to gcc 4.7 and code that compiled with 4.5.3 broke.
It appears that boost::fusion expects boost::fusion::random_access_traversal_tag to implicitly cast to mpl::bool_<false>.
Switching the 3rd argument from mpl::bool_<false> to an extra template arg (that was ignored), seems to fix the compilation errors.
Compiled with std=c++11
Do you have a minimal test case?
#include <boost/fusion/container/vector.hpp> #include <boost/fusion/algorithm.hpp> #include <boost/fusion/include/make_vector.hpp>
struct visitor { template<typename T> void operator()( T t )const{} };
int main() { visitor v; boost::fusion::for_each( boost::fusion::make_vector(5,6.6), v ); return 0; }
This compiles fine for me with --std=c++11 with GCC 4.7.0 (released version) on MinGW. Regards, Nate
participants (5)
-
Daniel Larimer
-
Joel de Guzman
-
Larry Evans
-
Mathias Gaunard
-
Nathan Ridge