https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90629

            Bug ID: 90629
           Summary: Support for -Wmismatched-new-delete
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: david.bolvansky at gmail dot com
  Target Milestone: ---

void alloc() {
    int *arr = new int [10];
    delete arr;
}

GCC with -Wall -Wextra - No warnings.


Clang with -Wall -Wextra:

<source>:5:5: warning: 'delete' applied to a pointer that was allocated with
'new[]'; did you mean 'delete[]'? [-Wmismatched-new-delete]

    delete arr;

    ^

          []

<source>:4:16: note: allocated with 'new[]' here

    int *arr = new int [10];

Reply via email to