1 // PR c++/93310 2 // { dg-do compile { target c++20 } } 3 4 struct A 5 { fA6 virtual constexpr char f () const 7 { return 'A'; } 8 }; 9 10 struct B : A 11 { 12 char x; 13 BB14 constexpr B () : x (0) 15 { x = ((A *)this)->f(); } 16 fB17 virtual constexpr char f () const 18 { return 'B'; } 19 }; 20 21 struct C : B 22 { fC23 virtual constexpr char f () const 24 { return 'C'; } 25 }; 26 27 constexpr C c; 28 static_assert (c.x == 'B'); 29