The following is a testcase distilled from a build failure while compiling CVS GDB:
/home/gdr/redhat/src/gdb/ada-lang.c: In function 'ada_lookup_symbol_list': /home/gdr/redhat/src/gdb/ada-lang.c:4659: warning: passing argument 3 of 'remove_out_of_scope_renamings' discards qualifiers from pointer target type make[2]: *** [ada-lang.o] Error 1 How to repeat: % cat b.c && gcc -c -O2 -Wall -Werror b.c struct T { int i; }; static int f(struct T* p) { return p->i; } int g(const struct T* p) { return f((struct T*)p); } int main(void) { struct T t = {0}; return g(&t); } cc1: warnings being treated as errors b.c: In function 'g': b.c:6: warning: passing argument 1 of 'f' discards qualifiers from pointer target type -- Summary: Bogus warning on argument passing discarding qualifiers Product: gcc Version: 4.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: gdr at gcc dot gnu dot org GCC host triplet: native build; platform independent http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30743