bug? cannot copy const array

jdonner jdonner@schedsys.com
Fri Feb 2 10:49:00 GMT 2001


Hi

   This won't compile with the gcc version 2.97 20010108 (experimental) 
snapshot.

int main()
{
   // works;
   const int constint = 7;
   int nint = constint;

   // so why not this?
   const int constarrayint[3] = { 1, 2, 3 };
   int arrayint[3];
   arrayint = constarrayint;
}


It complains:

bug.cpp:10: incompatible types in assignment of `const int[3]' to `int[3]'

Surely this is a bug, since you can copy a const int to an int, no?

JDonner



More information about the Gcc-bugs mailing list