llvm-for-llvmta/tools/clang/test/SemaCXX/delete-mismatch.h

16 lines
385 B
C
Raw Normal View History

2022-04-25 13:02:35 +02:00
// 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}:"[]"
}
};
}