[LLVMdev] Bogus warning?

Brent Walker brenthwalker at gmail.com
Thu Jan 12 09:13:46 PST 2012


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
[-Wincompatible-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?

Brent



More information about the llvm-dev mailing list