不推荐使用的struct members C++

ste*_*fan 10 c++ gcc

GCC 6.1.1给出了一个关于C++代码的弃用声明警告

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;
Run Code Online (Sandbox Code Playgroud)

文件指出,"已被废弃的属性导致警告如果变量在源文件中的任何地方使用."

由于警告指向第一行(struct foo),这是否意味着引发警告,因为结构是"使用"已弃用的成员?有没有办法将deprecated属性用于静态const结构成员?

GCC 4.9.3似乎没有给出这个警告.

ste*_*fan 1

看来这是 GCC >= 5.0 的一个错误(https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71274)。