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似乎没有给出这个警告.
| 归档时间: |
|
| 查看次数: |
380 次 |
| 最近记录: |