Compiler Error C2452

array bound expression of type 'type' is illegal

An array was declared with a bound expression that could not be converted to type int.

The following is an example of this error:

class C { int a; } aC;
class D { public: int a; operator int() { return a; } } aD;
class E { public: double a; operator double() { return a; } } aE;
int (*pf)();

void func()
{
   char *buf;
   int *pi;  
   
   buf = new char[aC];  // error, no conversion from C to int
   buf = new char[pi];  // error, int * is illegal type for array bound
   buf = new char[pf];  // error, int (*)() is illegal for array bound
   buf = new char[10L]; // OK
   buf = new char[aD];  // OK, conversion by D::operator int()
   buf = new char[aE];  // OK, conversion by E::operator double()
}