https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77849
Bug ID: 77849 Summary: [regression/4.9] Warning about deprecated enum even when "-Wdeprecated-declarations" is off Product: gcc Version: 6.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: thiago at kde dot org Target Milestone: --- $ cat test.cpp class C { public: enum __attribute__((__deprecated__("Do not use"))) MyEnum { Foo, Bar }; #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wdeprecated-declarations" __attribute__((__deprecated__("Really, do not use"))) static const MyEnum mySpecialEnum = Foo; #pragma GCC diagnostic pop }; int main() { return C::Foo; } $ gcc-6 -fsyntax-only test.cpp test.cpp:1:7: warning: ‘C::mySpecialEnum’ is deprecated: Really, do not use [-Wdeprecated-declarations] test.cpp:12:79: note: declared here Notes: * no warnings on GCC 4 * warnings on mySpecialEnum in GCC 5 and 6 (not about the actual enum usage, about the actual definition of mySpecialEnum) * no warnings with ICC * warnings in main on clang 3.7-3.9 Sorry, I don't have a GCC trunk (7) build available.