This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/71274] New: deprecated static const member of struct raises warning without use
- From: "vigerske at math dot hu-berlin.de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 25 May 2016 12:57:07 +0000
- Subject: [Bug c++/71274] New: deprecated static const member of struct raises warning without use
- Auto-submitted: auto-generated
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.