view clang/test/SemaCXX/delete-mismatch.h @ 221:79ff65ed7e25

LLVM12 Original
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Tue, 15 Jun 2021 19:15:29 +0900
parents 1d019706d866
children
line wrap: on
line source

// Header for PCH test delete.cpp
namespace pch_test {
struct X {
  int *a;
  X();
  X(int);
  X(bool)
    : a(new int[1]) { } // expected-note{{allocated with 'new[]' here}}
  ~X()
  {
    delete a; // expected-warning{{'delete' applied to a pointer that was allocated with 'new[]'; did you mean 'delete[]'?}}
    // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:9-[[@LINE-1]]:9}:"[]"
  }
};
}