The following code stopped working with gcc-4.5. gcc-4.4.3 and clang both accept it. On gcc-4.5, boost::mpl_::arg<2> is passed to metafunction instead of test1. The strange thing is: If the specialization of metafunction<_2> is provided, the code works again. I'm sorry that this is not a minimal test case, because I don't know how to get rid of the MPL parts.
#include <boost/mpl/placeholders.hpp> #include <boost/mpl/fold.hpp> #include <boost/mpl/push_back.hpp> #include <boost/mpl/at.hpp> #include <boost/mpl/vector/vector10.hpp> struct test1 { typedef int inner_type; }; template< typename Foo > struct metafunction { typedef typename Foo::inner_type type; }; #if 0 template<> struct metafunction< boost::mpl::_2 >; #endif int main() { typedef boost::mpl::fold< boost::mpl::vector1< test1 >, boost::mpl::vector0<>, boost::mpl::push_back< boost::mpl::_1, metafunction< boost::mpl::_2 > > >::type transformed; boost::mpl::at_c<transformed, 0>::type i = 42; } -- Summary: Boost.MPL code doesn't get the placeholders substituted anymore Product: gcc Version: 4.5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: sefi at s-e-f-i dot de http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43608