On Fri, 27 Dec 2002, Matthias Klose wrote: > gcc generates a warning for the following test program, that I believe > is inappropriate. The warning is that it cannot implicitly cast from > (foo *) to (const foo *). This occurs when foo is an array type. The > sample program compiles without warnings if you remove the "const" > keyword, or if you remove the [16] making foo an array.
It is an assignment from "pointer to array[16] of char" to "pointer to array[16] of const char" rather than to "pointer to const array[16] of char", by virtue of the requirement (6.7.3#8 in C99) that a type qualifier applied to an array type applies instead to the element type. Thus the case of 6.5.16.1#1 that would be matched in the case of pointers to nonarray types adding qualifiers is not matched, thus the warning. -- Joseph S. Myers [EMAIL PROTECTED]