GCC 6.1.1 gives me a deprecated declaration warning on the C++ code
struct foo
{
__attribute__ ((deprecated)) static const int a = 1;
};
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 = 1;
The documentation says that "The deprecated attribute results in a warning if the variable is used anywhere in the source file.".
As the warning points to the first line (struct foo), does that mean that the warning is raised because the struct is "using" the deprecated member? Is there a way to use the deprecated attribute for static const struct members?
GCC 4.9.3 does not seem to give this warning.
It seems that this is a bug of GCC >= 5.0 (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71274).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With