gcc/testsuite/g++.dg/cpp2a/constexpr-new10.C
raw| 1 | // PR c++/91369 |
| 2 | // { dg-do compile { target c++20 } } |
| 3 | // { dg-additional-options "-fdelete-null-pointer-checks" } |
| 4 | |
| 5 | struct S { |
| 6 | constexpr S (int* i) : s{i} {} |
| 7 | constexpr ~S () { delete s; } |
| 8 | int *s; |
| 9 | }; |
| 10 | |
| 11 | struct T { S t = { new int }; }; |
| 12 | |
| 13 | constexpr auto |
| 14 | foo () |
| 15 | { |
| 16 | T b; |
| 17 | return true; |
| 18 | } |
| 19 | |
| 20 | static_assert (foo ()); |