1 // PR c++/93633 2 // { dg-do compile { target c++2a } } 3 4 struct A { AA5 constexpr A () : a (0) {} fooA6 virtual int foo () { return 1 + a * 4; } 7 int a; 8 }; 9 10 struct B : A { BB11 constexpr B () : b (0) {} fooB12 virtual int foo () { return 0 + b * 4; } // { dg-message "declared here" } 13 int b; 14 }; 15 16 constexpr int foo()17foo () 18 { 19 A *a = new B (); 20 a->a = 4; 21 int r = a->foo (); // { dg-error "call to non-.constexpr. function" } 22 delete a; 23 return r; 24 } 25 26 constexpr auto a = foo (); 27