https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71274
Bug ID: 71274 Summary: deprecated static const member of struct raises warning without use Product: gcc Version: 6.1.1 Status: UNCONFIRMED Keywords: diagnostic Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: vigerske at math dot hu-berlin.de Target Milestone: --- When compiling the code struct foo { __attribute__ ((deprecated)) static const int a; }; with GCC 6.1.1 (g++), it raises a deprecated-declaration warning: dep.cpp:1:8: warning: ‘foo::a’ is deprecated [-Wdeprecated-declarations] struct foo ^~~ dep.cpp:3:50: note: declared here __attribute__ ((deprecated)) static const int a; This is unexpected to me, as the documentation says that "The deprecated attribute results in a warning if the variable is used anywhere in the source file.". But it is not used anywhere.