Bogus warning?

For the following (reduced) program:

bool f(double** x)
   const double *const *const p = x;

   return !p;

Clang outputs the following warning:

warning: initializing 'const double *const *const' with an expression
of type 'double **' discards qualifiers in nested pointer types
const double *const *const p = x;

I believe the code is correct. Both gcc (-Wall) and the visual studio
compiler compile the code without warnings. I had to add an explicit
cast to avoid the warning.

Should I be filling a bug report or is the warning legitimate?


The warning is legitimate, but slightly misleading. Basically, the
implicit const conversion only works on the outer pointer level.
So assigning foo * to const foo * is fine, but assign foo ** to const
foo ** is not. You should get a warning from GCC too --
"initialization from incompatible pointer type".