3 // { dg-options "-std=c++2a" }
7 virtual int f1() const = 0;
8 virtual int f2() const = 0;
9 virtual int f3() const = 0;
15 constexpr virtual int f1() const { return 21; }
16 constexpr virtual int f2() const { return 22; }
17 constexpr virtual int f3() const { return 23; }
23 virtual int f1() const { return 31; }
24 virtual int f2() const { return 32; }
25 virtual int f3() const { return 33; }
31 constexpr virtual int f1() const { return 41; }
32 constexpr virtual int f2() const { return 42; }
33 constexpr virtual int f3() const { return 43; }
36 constexpr int (X1::*pf)() const = &X1::f2;
39 static_assert(x2.f2() == 22);
40 static_assert((x2.*pf)() == 22);
42 constexpr X1 const& r2 = x2;
43 static_assert(r2.f2() == 22);
44 static_assert((r2.*pf)() == 22);
46 constexpr X1 const* p2 = &x2;
47 static_assert(p2->f2() == 22);
48 static_assert((p2->*pf)() == 22);
51 static_assert(x4.f2() == 42);
52 static_assert((x4.*pf)() == 42);
54 constexpr X1 const& r4 = x4;
55 static_assert(r4.f2() == 42);
56 static_assert((r4.*pf)() == 42);
58 constexpr X1 const* p4 = &x4;
59 static_assert(p4->f2() == 42);
60 static_assert((p4->*pf)() == 42);