testsuite: update mangling
[official-gcc.git] / gcc / testsuite / g++.dg / cpp2a / constexpr-new12.C
blob832782e1427fc8dbb4a1ff74cd56b2d1b9047570
1 // PR c++/93633
2 // { dg-do compile { target c++20 } }
3 // { dg-additional-options "-fdelete-null-pointer-checks" }
5 struct A {
6   constexpr A () : a (0) {}
7   constexpr virtual int foo () { return 1 + a * 4; }
8   int a;
9 };
11 struct B : A {
12   constexpr B () : b (0) {}
13   constexpr virtual int foo () { return 0 + b * 4; }
14   int b;
17 constexpr int
18 foo ()
20   A *a = new B ();  // { dg-message "allocated here" }
21   a->a = 4;
22   delete a;
23   int r = a->foo ();  // { dg-error "constant expression" }
24   return r;
27 constexpr auto a = foo ();  // { dg-message "in .constexpr. expansion" }