https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67488
Bug ID: 67488 Summary: Incorrect error message on call of nested functions Product: gcc Version: 6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: chengniansun at gmail dot com Target Milestone: --- The function 'f' is declared locally in a function scope, and then called outside. GCC emits an error that 'f' has incompatible declarations. I wonder whether this message could be improved by pinpointing the root cause, like Clang. $: cat t.c void g() { void f(void); } void k() {f();} $: clang-trunk -c t.c t.c:4:11: warning: use of out-of-scope declaration of 'f' void k() {f();} ^ t.c:2:8: note: previous declaration is here void f(void); ^ 1 warning generated. $: gcc-trunk -c t.c t.c: In function ‘k’: t.c:4:11: warning: implicit declaration of function ‘f’ [-Wimplicit-function-declaration] void k() {f();} ^ t.c:2:8: note: previous declaration of ‘f’ was here void f(void); ^ t.c:4:11: error: incompatible implicit declaration of function ‘f’ void k() {f();} ^ t.c:2:8: note: previous implicit declaration of ‘f’ was here void f(void); ^ $: $: gcc-trunk -v Using built-in specs. COLLECT_GCC=gcc-trunk COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/6.0.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../gcc-trunk/configure --enable-languages=c,c++,objc,obj-c++,fortran,lto --disable-werror --with-gmp=/usr/local/gcc-trunk --with-mpfr=/usr/local/gcc-trunk --with-mpc=/usr/local/gcc-trunk --with-cloog=/usr/local/gcc-trunk --prefix=/usr/local/gcc-trunk Thread model: posix gcc version 6.0.0 20150907 (experimental) [trunk revision 227515] (GCC) $: