Compiler Error C2271
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 C2271.
operator' : new/delete cannot have formal list modifiers
The operator (new or delete) is declared with a memory-model specifier.
The following sample generates C2271:
// C2271.cpp
// compile with: /c
void* operator new(size_t) const { // C2271
// try the following line instead
// void* operator new(size_t) {
return 0;
}
struct X {
static void* operator new(size_t) const; // C2271
// try the following line instead
// void * X::operator new(size_t) const; // static member operator new
};
Show: