Debian Codegraph @

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

raw
1 // PR c++/91369
2 // { dg-do compile { target c++20 } }
3 // { dg-additional-options "-fdelete-null-pointer-checks" }
4
5 struct A {
6 constexpr A () : p{new int} {}
7 constexpr ~A () { delete p; }
8 int *p;
9 };
10
11 constexpr bool
12 test ()
13 {
14 A{};
15 return true;
16 }
17
18 constexpr auto res = test ();
19 static_assert (res);