https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80544
--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> --- GCC now accepts the original testcase, and with -Wignored-qualifiers (which is included in -Wextra) prints: q.cc: In function ‘int main()’: q.cc:8:30: warning: type qualifiers ignored on cast result type [-Wignored-qualifiers] f(const_cast<int* const>(&i)); ^ I couldn't figure out how to get the caret to point to the ignored qualifier.