Compiler Error C2203

 

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 C2203.

delete operator cannot specify bounds for an array

With the /Za (ANSI) option, the delete operator can delete an entire array but not parts or specific members of the array.

The following sample generates C2203:

// C2203.cpp  
// compile with: /Za  
int main() {  
   int *ar = new int[10];  
   delete [4] ar;   // C2203  
   // try the following line instead  
   // delete [] ar;  
}  

Show: