[Bug c++/50956] New: -Wcast-qual does not work

joerg.richter@pdv-fs.de gcc-bugzilla@gcc.gnu.org
Wed Nov 2 07:34:00 GMT 2011


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50956

             Bug #: 50956
           Summary: -Wcast-qual does not work
    Classification: Unclassified
           Product: gcc
           Version: 4.6.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: joerg.richter@pdv-fs.de


-Wcast-qual seems to be broken since at least GCC 4.1.1.

cat > t.cc <<EOF
int main( int, char** )
{
  void* p = (void*)"txt";
  return 0;
}
EOF
g++ -o /dev/null -c t.cc -Wcast-qual  # no warning

GCC 3.4.5 gives a warning:
t.cc: In function `int main(int, char**)':
t.cc:3: warning: cast from `const char*' to `void*' discards qualifiers from
pointer target type



More information about the Gcc-bugs mailing list