This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/52057] New: dropping "const" in assignment gives only a warning


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.)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]