This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/52057] New: dropping "const" in assignment gives only a warning
- From: "jens.maurer at gmx dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 30 Jan 2012 20:02:11 +0000
- Subject: [Bug c/52057] New: dropping "const" in assignment gives only a warning
- Auto-submitted: auto-generated
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.)