https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68954
--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> --- Breakpoint 1, diagnostic_classify_diagnostic ( context=0x2467de0 <global_diagnostic_context>, option_index=213, new_kind=DK_IGNORED, where=1550920) at /space/rguenther/src/svn/gcc-5-branch/gcc/diagnostic.c:633 (gdb) p expand_location (where) $1 = { file = 0x24e7490 "/home/space/rguenther/install/gcc-5.3/include/c++/5.3.0/backward/binders.h", line = 61, column = 32, data = 0x0, sysp = true} where context->option_enabled returns 1 and thus old_kind gets DK_ERROR which is not true (for whatever reason). Thus the handling seems to be still inconsistent with actual warning uses. Interestingly even with GCC 5.1 we error for the following with -Werror template <class T> class auto_ptr { } __attribute__((deprecated)); int main() { int i; auto_ptr<int> x; } But we do _not_ -Werror for the following (we error only since the diagnostic change and thus GCC 5.3): #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wdeprecated-declarations" template <class T> class auto_ptr { } __attribute__((deprecated)); #pragma GCC diagnostic pop int main() { int i; auto_ptr<int> x; }