Compiler Error C2541

 

For the latest documentation on Visual Studio 2017 RC, see Visual Studio 2017 RC Documentation.

'delete' : delete : cannot delete objects that are not pointers

The delete operator was used on an object that is not a pointer.

The following sample generates C2541:

// C2541.cpp  
int main() {  
   int i;  
   delete i;   // C2541 i not a pointer  
  
   // OK  
   int *ip = new int;  
   delete ip;  
}  

Show: