The following code compiles without warning on GCC but gives a warning in Visual Studio 2005.
const void * x = 0;
char * const * p = x;
x p
The C code is valid and a conforming compiler shouldn't warn as const
ness is correctly preserved and conversion of void *
to any pointer type (function pointers aside) is implicit.
A C++ compiler is supposed to warn about the implicit conversion, but a warning about discarding the const
qualifier is wrong and should be considered a compiler bug.