编译器错误 C2495

“identifier”:“nothrow”只能应用于函数声明或定义

nothrow 扩展属性只能应用于函数声明或定义。

以下示例生成 C2495:

// C2495.cpp
// compile with: /c
__declspec(nothrow) class X {   // C2495
   int m_data;
} x;

__declspec(nothrow) void test();   // OK