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: unassig...@gcc.gnu.org
        ReportedBy: jens.mau...@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.)

Reply via email to