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

error: incomplete type is not allowed

john_price00gmail_co
717 Views
Hi,

I am compiling a source code library that works flawlessly with Visual Studio 2008 (VC90), Visual Studio 2010 RCand gcc under Linux, but fails when compiled with any recent version of Intel's C++ compiler (11.1, 12.0.0.016). I get "error: incomplete type is not allowed" at the location shown below marked with << error: incomplete type is not allowed.

Is there a way to modify this to work with an Intel C++ compiler? Since Visaul Studio 2010 RC is a new compiler and compiles and runs this without error, is this a bug in the Intel C++ compiler?

namespace Wm5

{

template

class Vector3 : public Tuple<3,Real>

{

public:

// Construction.

Vector3 (); // uninitialized

Vector3 (const Vector3& vec);

................ class declaration stuff edited ....................

void GetBarycentrics (const Vector3& v0, const Vector3& v1, const Vector3& v2, const Vector3& v3, Real bary[4]) const;

struct Information
{

// The intrinsic dimension of the input set. The parameter 'epsilon'

// to the GetInformation function is used to provide a tolerance when

// determining the dimension.

int mDimension;

// Axis-aligned bounding box of the input set. The maximum range is

// the larger of max[0]-min[0], max[1]-min[1], and max[2]-min[2].

Real mMin[3], mMax[3];

Real mMaxRange;

// Coordinate system. The origin is valid for any dimension d. The

// unit-length direction vector is valid only for 0 <= i < d. The

// extreme index is relative to the array of input points, and is also

// valid only for 0 <= i < d. If d = 0, all points are effectively

// the same, but the use of an epsilon may lead to an extreme index

// that is not zero. If d = 1, all points effectively lie on a line

// segment. If d = 2, all points effectively line on a plane. If

// d = 3, the points are not coplanar.

Vector3 mOrigin;

>> Vector3 mDirection[3]; << error: incomplete type is not allowed

// The indices that define the maximum dimensional extents. The

// values mExtreme[0] and mExtreme[1] are the indices for the points

// that define the largest extent in one of the coordinate axis

// directions. If the dimension is 2, then mExtreme[2] is the index

// for the point that generates the largest extent in the direction

// perpendicular to the line through the points corresponding to

// mExtreme[0] and mExtreme[1]. Furthermore, if the dimension is 3,

// then mExtreme[3] is the index for the point that generates the

// largest extent in the direction perpendicular to the triangle

// defined by the other extreme points. The tetrahedron formed by the

// points V[extreme0], V[extreme1], V[extreme2], V[extreme3]> is

// clockwise or counterclockwise, the condition stored in mExtremeCCW.

int mExtreme[4];

bool mExtremeCCW;

};

// The value of epsilon is used as a relative error when computing the

// dimension of the point set.

static void GetInformation (int numPoints, const Vector3* points,

Real epsilon, Information& info);

// Special vectors.

static const Vector3 ZERO; // (0,0,0)

static const Vector3 UNIT_X; // (1,0,0)

static const Vector3 UNIT_Y; // (0,1,0)

static const Vector3 UNIT_Z; // (0,0,1)

static const Vector3 ONE; // (1,1,1)

protected:

using Tuple<3,Real>::mTuple;

};

// Arithmetic operations.

template

inline Vector3 operator* (Real scalar, const Vector3& vec);

// Debugging output.

template

std::ostream& operator<< (std::ostream& outFile, const Vector3& vec);

#include "Wm5Vector3.inl"

typedef Vector3 Vector3f;

typedef Vector3 Vector3d;

}

#endif

0 Kudos
3 Replies
Judith_W_Intel
Employee
717 Views

Belowis a small reproducer which compiles with cl and g++ but not icpc or icl. I have entered this is in
our bug tracking database as cq #153823. thanks for reporting it, we will fix it ASAP.

template
struct Vector3
{
struct Information
{
Vector3 mOrigin; // compiles without error
Vector3 mDirection[3]; // error: incomplete type is not allowed
};
};

The only workaround I can think of is to move the declaration of the nested class Information outside the Vector3 class, i.e.:


template
struct Vector3
{
struct Information;
};

template
struct Vector3::Information
{
Vector3 mOrigin;
Vector3 mDirection[3];
};

The otherpossible woraroundis instead of declaring an array for mDirection you declare a pointer which you would then need to dynamically allocate and deallocate as needed.

Judy

0 Kudos
Feilong_H_Intel
Employee
717 Views
Hi John,

Engineering team has implemented a fix for this issue. I'll let you know when a compiler update contains the fix is available for download.

Thanks,
Feilong
0 Kudos
Feilong_H_Intel
Employee
717 Views

icl 11.1.067 contains the fix for this issue already.

Thanks,
Feilong

0 Kudos
Reply