>From PR35637 but this is a general issue of the diagnostic machinery. The problem is: -pedantic no warning, -pedantic-errors gives an error.
Explanation: The pedantic warning is in a system header, so it doesn't get emitted. When using -pedantic-errors, it is an error, and errors are always emitted. Longer explanation: The problem is in diagnostics.c (diagnostic_report_diagnostic) which checks only for DK_WARNING if they should be inhibited (either because of -w or because location is within system headers. However, pedwarn() is passing a DK_ERROR when -pedantic-errors is enabled. One possible fix is that pedwarn() always passes a DK_WARNING type, while -pedantic-errors reclassifies -pedantic warnings to emit errors. In other words, -pedantic-errors would behave internally like -Werror=pedantic. -- Summary: pedwarn() + -pedantic-errors + -w (inhibit_warnings) should not emit errors Product: gcc Version: 4.4.0 Status: UNCONFIRMED Keywords: diagnostic Severity: normal Priority: P3 Component: other AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: manu at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36901