int main(void) { const char *x = 0; char *y = (char *)x; return 0; } gcc -Wcast-qual warns: test.c:4: warning: cast discards qualifiers from pointer target type clang warns nothing.
Hi! Following patch adds support for this warning http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20120618/059295.html Please, review.
Ping?
This was (re)implemented in r222568.
(In reply to Timo Sirainen from comment #0) > int main(void) > { > const char *x = 0; > char *y = (char *)x; > return 0; > } > > gcc -Wcast-qual warns: > > test.c:4: warning: cast discards qualifiers from pointer target type > > clang warns nothing. clang-4.0 still does not warn on that. https://godbolt.org/g/3SEdPm
Upon further research, it seems that clang's -Wcast-qual does work for C, but unlike gcc's -Wcast-qual, does not do anything in C++.
Opened https://reviews.llvm.org/D33102 Do not know who to add as reviewers there.
D33102 has just re-landed.