[cfe-dev] -Wcast-qual not working

Chengnian Sun chengniansun at gmail.com
Sun Jul 20 14:53:50 PDT 2014


Does Clang support the warning flag -Wcast-qual? I have the following

$: cat t.c
int * f (const int*a) {
  return (int *)a;

$: clang-trunk -Weverything -c t.c
t.c:1:7: warning: no previous prototype for function 'f'
int * f (const int*a) {
1 warning generated.
$: gcc-trunk -Wcast-qual -c t.c
t.c: In function ‘f’:
t.c:2:10: warning: cast discards ‘const’ qualifier from pointer target type
   return (int *)a;

Best Regards.

Chengnian SUN.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140720/00f46798/attachment.html>

More information about the cfe-dev mailing list