C1436: delete needs number of elements of array

[WARNING]

Description

A call to the delete[] operator was made without specifying the number of elements of the array, which is necessary for deleting a pointer to a class needing to call a destructor.

Example
  class A {

  
    // ...

  
    ~A();

  
  };

  
  class B {

  
    // ...

  
  };

  
  void f(A *ap, B *bp) {

  
    delete ap;     // ok

  
    delete[] ap;   // error

  
    delete[4] ap;  // ok

  
    delete bp;     // ok

  
    delete[] bp;   // ok

  
    delete[4] bp;  // ok

  
  }

  
Tips

Specify the number of elements at calling delete[].