Getting "incomplete type is not allowed" error

Getting "incomplete type is not allowed" error

Hi,

  while trying to compile following code using "icc compiler 15.0.0", I am getting the follow error (this code compiles fine with gcc 4.7.2)

>cat foo.cpp
#include "boost/mpl/pop_back.hpp"
#include "boost/mpl/copy_if.hpp"
#include "boost/mpl/vector.hpp"
#include "boost/mpl/eval_if.hpp"
#include "boost/mpl/empty.hpp"
template <class T>
struct LastEnrollerHelper
{
  static void enroll(int, T*) {}
};
template< class T, class TVector>
struct EnrollerHelper
{
  static void enroll(int iReg, T* iT)
  {
    typedef typename boost::mpl::eval_if<boost::mpl::empty<TVector>,
           boost::mpl::identity<LastEnrollerHelper<T> >,
           boost::mpl::identity<EnrollerHelper<T, typename boost::mpl::pop_back< TVector >::type > >
           >::type NextEnroller;
    NextEnroller::enroll(iReg,iT);
  }
};
void func(){EnrollerHelper<int,boost::mpl::vector<int> >::enroll(1,0);}

muzaffar@cmsdev03.cern.ch>icpc -v
icpc version 15.0.0 (gcc version 4.7.2 compatibility)
muzaffar@cmsdev03.cern.ch>icpc -c -I/boost/1.47.0/include -o foo.o foo.cpp
/boost/1.47.0/include/boost/mpl/pop_back.hpp(29): error: incomplete type is not allowed
      : pop_back_impl< typename sequence_tag<Sequence>::type >
        ^
          detected during:
            instantiation of class "boost::mpl::pop_back<Sequence> [with Sequence=boost::mpl::vector0<boost::mpl::na>]" at line 20 of "foo.cpp"
            instantiation of "void EnrollerHelper<T, TVector>::enroll(int, T *) [with T=int, TVector=boost::mpl::vector0<boost::mpl::na>]" at line 22 of "foo.cpp"
            instantiation of "void EnrollerHelper<T, TVector>::enroll(int, T *) [with T=int, TVector=boost::mpl::vector<int, boost::mpl::na, boost::mpl::na, boost::mpl::na, boost::mpl::na, boost::mpl::na, boost::mpl::na, boost::mpl::na, boost::mpl::na, boost::mpl::na, boost::mpl::na, boost::mpl::na, boost::mpl::na, boost::mpl::na, boost::mpl::na, boost::mpl::na, boost::mpl::na, boost::mpl::na, boost::mpl::na, boost::mpl::na>]" at line 26 of "foo.cpp"

foo.cpp(20): error: class "boost::mpl::pop_back<boost::mpl::vector0<boost::mpl::na>>" has no member "type"
             boost::mpl::identity<EnrollerHelper<T, typename boost::mpl::pop_back< TVector >::type > >
                                                                                              ^
          detected during:
            instantiation of "void EnrollerHelper<T, TVector>::enroll(int, T *) [with T=int, TVector=boost::mpl::vector0<boost::mpl::na>]" at line 22
            instantiation of "void EnrollerHelper<T, TVector>::enroll(int, T *) [with T=int, TVector=boost::mpl::vector<int, boost::mpl::na, boost::mpl::na, boost::mpl::na, boost::mpl::na, boost::mpl::na, boost::mpl::na, boost::mpl::na, boost::mpl::na, boost::mpl::na, boost::mpl::na, boost::mpl::na, boost::mpl::na, boost::mpl::na, boost::mpl::na, boost::mpl::na, boost::mpl::na, boost::mpl::na, boost::mpl::na, boost::mpl::na>]" at line 26

compilation aborted for foo.cpp (code 2)

 

Any idea what am I doing wrong here?

5 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Hi Shahzad,

I've reproduced the problem with 15.0 beta compiler.  I'm entering it to our problem-tracking database.  Will let you know once I hear from icc engineering team.

Thanks.

Thanks

Hi Shahzad,

Our engineering team looked at this issue, and found that it looks like an issue in boost.  The problem comes from /boost_1_47_0/boost/mpl/aux_/config/gcc.hpp, where you can see something like this:

#if defined(__GNUC__) && !defined(__EDG_VERSION__)
#   define BOOST_MPL_CFG_GCC ((__GNUC__ << 8) | __GNUC_MINOR__)
#else
#   define BOOST_MPL_CFG_GCC 0
#endif

 

Since icc defines both __GNUC__ & __EDG_VERSION, the macro BOOST_MPL_CFG_GCC is defined as 0, which caused the problem you reported.  A fix would be to check if compiler is icc.

#if defined(__GNUC__) && !defined(__EDG_VERSION__) || defined(__INTEL_COMPILER)
#   define BOOST_MPL_CFG_GCC ((__GNUC__ << 8) | __GNUC_MINOR__)
#else
#   define BOOST_MPL_CFG_GCC 0
#endif

 

Please let me know if this works for you.

Thanks.

 

Thanks, after fixing the boost header, I am able to compile our code now.

Leave a Comment

Please sign in to add a comment. Not a member? Join today