blob: e97e7aa6a6aa931d4c0c4e19f12b59631cab312a [file] [log] [blame]
// PR c++/95808
// { dg-do compile { target c++20 } }
constexpr
bool foo ()
{
int *p = new int; // { dg-message "allocation performed here" }
delete[] p; // { dg-error "array deallocation of object allocated with non-array allocation" }
return false;
}
constexpr
bool bar ()
{
int *p = new int[1]; // { dg-message "allocation performed here" }
delete p; // { dg-error "non-array deallocation of object allocated with array allocation" }
return false;
}
constexpr auto x = foo ();
constexpr auto y = bar ();