Compiler Warning (level 1) C4155
Collapse the table of content
Expand the table of content
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer

Compiler Warning (level 1) C4155

deletion of an array expression without using the array form of 'delete'

The array form of delete should be used to delete an array. This warning occurs only under ANSI-compatibility (/Za).

The following sample generates C4155:

// C4155.cpp
// compile with: /Za /W1
#include <stdio.h>
int main(void)
   int (*array)[ 10 ] = new int[ 5 ] [ 10 ];
   array[0][0] = 8;
   printf("%d\n", array[0][0]);
   delete array;   // C4155
   // try the following line instead
   // delete [] array;   // C4155
© 2016 Microsoft