https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86440
Yohei Kojima <y.koj.eel at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |y.koj.eel at gmail dot com --- Comment #3 from Yohei Kojima <y.koj.eel at gmail dot com> --- gcc 13.2.0 reports warnings as follows: $ g++ -Wignored-qualifiers -c a.cc a.cc:1:1: warning: type qualifiers ignored on function return type [-Wignored-qualifiers] 1 | int const f() { return 0; } | ^~~ a.cc:3:1: warning: type qualifiers ignored on function return type [-Wignored-qualifiers] 3 | int * const g() { return 0; } | ^~~ Also, with the following C source b.c, gcc reports errors at the wrong confusing location. $ cat b.c void f(void *const (*)(void)) { } void g(void *const (*h)(void)) { } The reported error was like below. Error report on g() is fine, but gcc points to the return type of outer function on f(), which was confusing to me. $ gcc -c -Wignored-qualifiers b.c b.c:1:1: warning: type qualifiers ignored on function return type [-Wignored-qualifiers] 1 | void f(void *const (*)(void)) { | ^~~~ b.c:4:22: warning: type qualifiers ignored on function return type [-Wignored-qualifiers] 4 | void g(void *const (*h)(void)) { | ^ Tested environment is gcc 13.2.0 on Docker (The current latest release available from https://hub.docker.com/_/gcc): $ gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-linux-gnu/13.2.0/lto-wrapper Target: x86_64-linux-gnu Configured with: /usr/src/gcc/configure --build=x86_64-linux-gnu --disable-multilib --enable-languages=c,c++,fortran,go Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 13.2.0 (GCC) I'm interested in fixing this bug, and I've started digging into the code.