blob: e97e7aa6a6aa931d4c0c4e19f12b59631cab312a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
// 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 ();
|