Compiler Warning (level 1) C4154
deletion of an array expression; conversion to pointer supplied
You cannot use delete
on an array, so the compiler converts the array to a pointer.
Example
// C4154.cpp
// compile with: /c /W1
int main() {
int array[ 10 ];
delete array; // C4154 can't delete stack object
int *parray2 = new int [10];
int (&array2)[10] = (int(&)[10]) parray2;
delete [] array2; // C4154
// try the following line instead
delete [] &array2;
}
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for