http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46765
Summary: Superfluous 'const' declaration does not generate error or warning Product: gcc Version: 4.5.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassig...@gcc.gnu.org ReportedBy: fredrik.hederstie...@securitas-direct.com Assume we want to declare a pointer to constant data. This can be done by e.g. int const * ptrToConst1; But C/C++ also accepts: //identical to: int const * ptrToConst, const int * ptrToConst2; But GCC also accept a double-const declation: //identical to ??: const int * ptrToConst2; //superfluous const? No warning nor error. const int const * ptrToConst3; The superfluous 'const' declaration does not generate error or warning. It's obvious that the programmer most likely wanted to declare "constant pointer to constant data", but he only gets "pointer to constant data". He should get a warning or parse error for this. It's no meaning to declare 'constant data' twice. The second const-declaration does not have any effect. I'm compiling with GCC-4.5.1 and having all possible warning flags: "-W -Wall -Wextra". I also attach small example file with test of various const-declarations.