Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7956 Discussions

Getting "incomplete type is not allowed" error

Shahzad_Malik_MUZAFF
1,725 Views

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?

0 Kudos
4 Replies
Feilong_H_Intel
Employee
1,725 Views

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.

0 Kudos
Shahzad_Malik_MUZAFF
1,725 Views

Thanks

0 Kudos
Feilong_H_Intel
Employee
1,725 Views

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.

 

0 Kudos
Shahzad_Malik_MUZAFF
1,725 Views

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

0 Kudos
Reply