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: unassig...@gcc.gnu.org
        ReportedBy: joerg.rich...@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

Reply via email to