[Bug c/43651] add warning for duplicate qualifier
miyuki at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Sep 23 17:13:00 GMT 2015
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43651
Mikhail Maltsev <miyuki at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |miyuki at gcc dot gnu.org
--- Comment #6 from Mikhail Maltsev <miyuki at gcc dot gnu.org> ---
Clang also emits a warning:
$ cat test.c
int foo(const char const *data);
$ /opt/clang-3.6.2/bin/clang -S -std=c89 test.c
test.c:1:20: warning: duplicate 'const' declaration specifier
[-Wduplicate-decl-specifier]
int foo(const char const *data);
^~~~~~
1 warning generated.
$ /opt/clang-3.6.2/bin/clang -S -std=c99 test.c
test.c:1:20: warning: duplicate 'const' declaration specifier
[-Wduplicate-decl-specifier]
int foo(const char const *data);
^
1 warning generated.
$ /opt/clang-3.6.2/bin/clang -xc++ -S -std=c++11 test.c
test.c:1:20: warning: duplicate 'const' declaration specifier
[-Wduplicate-decl-specifier]
int foo(const char const *data);
^~~~~~
1 warning generated.
"-pedantic-errors" turns this warning into an error in C++ and C89 (but not
C99).
Recently I came across such problem in the code base, which I work with. In
that case it was clearly a mistake, because the author meant 'const char *const
data', so it would be nice if GCC could warn about this.
More information about the Gcc-bugs
mailing list