https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111669
--- Comment #6 from Zeb Figura <zfigura at codeweavers dot com> --- It is my impression that gcc is interested in avoiding false positives for its warnings. This isn't to say that there aren't some number of false positives in existence, but it is my impression that gcc is interested in reducing that number. It is also my impression that -Wnonnull is not *supposed* to emit warnings for cases where, from the compiler's point of view, NULL might be passed, but some high-level invariant prevents this. Compare -Wmaybe-uninitialized, where the documentation clearly specifies otherwise. If both of these impressions are incorrect, this bug report can be closed as WONTFIX. (In reply to Xi Ruoyao from comment #5) > And you can tell the compiler some fact about the semantics of the Windoge > API functions if you really need -Werror=nonnull (though I cannot see any > reason you must use -Werror here): If it makes a difference, please feel free to pretend I said -Wnonnull, rather than -Werror=nonnull. It was merely a debugging aid, meant to help me try to narrow down the conditions causing this error.