arocc
arocc copied to clipboard
pointer cast warnings too strict
This currently gives a warning when it shouldn't:
void foo(const void *arg) {
const char * const p1 = (const char * const)arg;
}
./test.c:2:27: warning: cast to type 'const char *const ' will not preserve qualifiers [-Wcast-qualifiers]
const char * const p1 = (const char * const)arg;
^
That error is actually talking about the second const and happens for other types as well:
void foo() {
const char p1 = (const char)1; // warning: cast to type 'char' will not preserve qualifiers [-Wcast-qualifiers]
}
This is an warning that I added so it should either be clarified or removed altogether.