From Bugzilla Helper: User-Agent: Mozilla/4.6C-CCK-MCD EMS-1.4 [en] (X11; U; SunOS 5.6 sun4m) gcc gives a warning "incompatible pointer type" when passing a char ** to a function where the argument is of type "const char * const *". gcc will allow the top level to become const without complaint (that is, passing (const char **) is perfectly acceptable). It seems that gcc should scan down through the type and allow const to be added at all levels during argument passing. Reproducible: Always Steps to Reproduce: 1.Compile the following program: const char f(const char * const * p) { return **p; } void g(void) { char *v = "testing"; char **q = &v; f( q ); /* gives error */ f( (const char **)q ); /* OK */ } Actual Results: gcc version 2.95.2 19991024 (release) gives: x.c:9: warning: passing arg 1 of 'f' from incompatible pointer type Expected Results: clean compile
No, gcc is correct on this. A pointer to 'const char *' is incompatible with pointer to 'char *', see ISO C standard, chapter 6.7.3.