[Bug c/52057] New: dropping "const" in assignment gives only a warning
jens.maurer at gmx dot net
gcc-bugzilla@gcc.gnu.org
Mon Jan 30 20:31:00 GMT 2012
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52057
Bug #: 52057
Summary: dropping "const" in assignment gives only a warning
Classification: Unclassified
Product: gcc
Version: 4.6.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: jens.maurer@gmx.net
According to C99 6.5.16.1p1, the following is ill-formed:
void * p = (const int *) 0;
However, gcc only issues a warning, not an error:
> gcc -c -ansi -pedantic 1251.c
1251.c:1:12: warning: initialization discards ‘const’ qualifier from pointer
target type [enabled by default]
(In C++ mode, the code above results in a hard error, as it should.)
More information about the Gcc-bugs
mailing list