Compiler Error C2495
Visual Studio 2015
The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.
The latest version of this topic can be found at Compiler Error C2495.
identifier' : 'nothrow' can only be applied to function declarations or definitions
The nothrow extended attribute can be applied to function declarations or definitions only.
The following sample generates C2495:
// C2495.cpp
// compile with: /c
__declspec(nothrow) class X { // C2495
int m_data;
} x;
__declspec(nothrow) void test(); // OK
Show: