Debian Codegraph @

gcc/testsuite/g++.dg/cpp2a/constexpr-new15.C

raw
1 // PR c++/95808
2 // { dg-do compile { target c++20 } }
3
4 constexpr
5 bool foo ()
6 {
7 int *p = new int; // { dg-message "allocation performed here" }
8 delete[] p; // { dg-error "array deallocation of object allocated with non-array allocation" }
9 return false;
10 }
11
12 constexpr
13 bool bar ()
14 {
15 int *p = new int[1]; // { dg-message "allocation performed here" }
16 delete p; // { dg-error "non-array deallocation of object allocated with array allocation" }
17 return false;
18 }
19
20 constexpr auto x = foo ();
21 constexpr auto y = bar ();