c++: P0847R7 (deducing this) - xobj lambdas. [PR102609]
[official-gcc.git] / gcc / testsuite / g++.dg / cpp2a / constexpr-new13.C
blob7eed50c7f4cfdbd1313d8b505df92fe54a3d69de
1 // PR c++/93633
2 // { dg-do compile { target c++20 } }
4 struct A {
5   constexpr A () : a (0) {}
6   virtual int foo () { return 1 + a * 4; }
7   int a;
8 };
10 struct B : A {
11   constexpr B () : b (0) {}
12   virtual int foo () { return 0 + b * 4; }      // { dg-message "declared here" "" { target { ! implicit_constexpr } } }
13   int b;
16 constexpr int
17 foo ()
19   A *a = new B ();
20   a->a = 4;
21   int r = a->foo ();    // { dg-error "call to non-.constexpr. function" "" { target { ! implicit_constexpr } } }
22   delete a;
23   return r;
26 constexpr auto a = foo ();