Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

deprecated struct members C++

Tags:

c++

gcc

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.

like image 854
stefan Avatar asked May 25 '16 10:05

stefan


1 Answers

It seems that this is a bug of GCC >= 5.0 (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71274).

like image 184
stefan Avatar answered Oct 25 '22 15:10

stefan