https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80785
--- Comment #4 from Daniel Gutson <daniel.gutson at intel dot com> --- (In reply to Jonathan Wakely from comment #3) > The usual reason a header has extern "C" is because it's intended for use by > both C and C++ programs, and in that case restructuring it for the benefit > of C++ only is probably not very likely. But then static variables in > headers aren't terribly common anyway, so maybe it's not a problem. I agree and acknowledge that a header having extern "C" is for including it from C and C++ files. I just ran into this issue from a real life situation, where the header file was a mess mixing static data intended to be "private/local" declarations for only one of the including files, which was exactly what had to be refactored. A warning that detects static declarations inside an extern "C" would evidence this messy situation, triggering the necessary refactor. It could be, as mentioned, an opt-in warning for projects where this case would be considered a design or implementation flaw.