[mpl] gcc problem with include order dependency

Aleksey, With gcc (GCC) 3.3.3 (cygwin special) there is a include order dependency. Including boost/bind.hpp before boost/mpl/transform.hpp causes a compile error type named `type' in `struct boost::mpl::apply_wrap2<boost::mpl::push_front<mpl_::na, mpl_::na>, mpl_::arg<1>, wrapper<mpl_::arg<2> > >' I have not been able to test with other gcc versions. Regards, Hugo #include "boost/bind.hpp" #include "boost/mpl/transform.hpp" #include <boost/mpl/apply.hpp> #include <boost/mpl/list.hpp> #include <boost/mpl/equal.hpp> #include <boost/mpl/assert.hpp> // computed type template <typename T> struct wrapper{}; // metafunction class to compute type struct wrapped_type { template <typename T> struct apply { typedef wrapper<T> type; }; }; void test_transform() { typedef boost::mpl::list<int, char> typelist; typedef boost::mpl::list< wrapper<int>, wrapper<char> > wrapped_typelist; typedef boost::mpl::transform< typelist, wrapped_type >::type result; BOOST_MPL_ASSERT(( boost::mpl::equal<wrapped_typelist, result> )); }

On Wed, Sep 15, 2004 at 12:28:08PM -0400, Hugo Duncan wrote:
Aleksey,
With gcc (GCC) 3.3.3 (cygwin special)
there is a include order dependency. Including boost/bind.hpp before boost/mpl/transform.hpp causes a compile error
type named `type' in `struct boost::mpl::apply_wrap2<boost::mpl::push_front<mpl_::na, mpl_::na>, mpl_::arg<1>, wrapper<mpl_::arg<2> > >'
I have not been able to test with other gcc versions.
With GCC 3.3.3 I get errors about _1 and _2 being ambiguous from the following testcase: #include <boost/bind.hpp> #include <boost/mpl/transform.hpp> (yes, that's it) The first error is /home/jw/include/boost/mpl/transform.hpp:45: error: use of `_1' is ambiguous /home/jw/include/boost/mpl/aux_/preprocessed/gcc/placeholders.hpp:26: error: first declared as `typedef struct mpl_::arg<1> mpl_::_1' here /home/jw/include/boost/bind/placeholders.hpp:54: error: also declared as ` boost::arg<1> <unnamed>::_1' here And similarly for _2 With GCC 3.4.3 (from CVS yesterday) the same testcase says _1 and _2 are undeclared: /home/jw/include/boost/mpl/transform.hpp:45: error: `_1' was not declared in this scope /home/jw/include/boost/mpl/transform.hpp:45: error: `_2' was not declared in this scope I can post the rest of the errors if needed, but they all seem to be as a consequence of those first errors. jon -- "A foolish consistency is the hobgoblin of little minds..." - Ralph Waldo Emerson

Jonathan Wakely writes:
On Wed, Sep 15, 2004 at 12:28:08PM -0400, Hugo Duncan wrote:
Aleksey,
With gcc (GCC) 3.3.3 (cygwin special)
there is a include order dependency. Including boost/bind.hpp before boost/mpl/transform.hpp causes a compile error
type named `type' in `struct boost::mpl::apply_wrap2<boost::mpl::push_front<mpl_::na, mpl_::na>, mpl_::arg<1>, wrapper<mpl_::arg<2> > >'
I have not been able to test with other gcc versions.
With GCC 3.3.3 I get errors about _1 and _2 being ambiguous from the following testcase:
#include <boost/bind.hpp> #include <boost/mpl/transform.hpp>
(yes, that's it)
Thanks, Jonathan, this was helpful! -- Aleksey Gurtovoy MetaCommunications Engineering

Hugo Duncan writes:
Aleksey,
With gcc (GCC) 3.3.3 (cygwin special)
there is a include order dependency. Including boost/bind.hpp before boost/mpl/transform.hpp causes a compile error
type named `type' in `struct boost::mpl::apply_wrap2<boost::mpl::push_front<mpl_::na, mpl_::na>, mpl_::arg<1>, wrapper<mpl_::arg<2> > >'
I have not been able to test with other gcc versions.
Fixed in the CVS, thanks for the report! -- Aleksey Gurtovoy MetaCommunications Engineering
participants (3)
-
Aleksey Gurtovoy
-
Hugo Duncan
-
Jonathan Wakely