https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80496
--- Comment #4 from Martin Sebor <msebor at gcc dot gnu.org> --- The incompatible attribute is diagnosed by -Wdiscarded-qualifiers along with type incompatibilities due to qualifier mismatches. Because qualifier mismatches are an error in C++ the warning is only available in C. The warning for attribute incompatibilities just needs to be added to or shared with C++ front-end.