1 // { dg-do compile { target c++20 } }
9 virtual consteval const B1 *foo1 () const {return this;}
10 virtual consteval const B2 *foo2 (const D *) const;
14 virtual consteval const B2 *baz1 () const {return this;}
15 virtual consteval const B1 *baz2 (const D *) const;
18 struct D : public B1, B2
20 virtual consteval const D *foo1 () const {return this;}
21 virtual consteval const D *foo2 (const D *d) const {return d;}
22 virtual consteval const D *baz1 () const {return this;}
23 virtual consteval const D *baz2 (const D *d) const {return d;}
26 consteval const B2 *B1::foo2 (const D *d) const {return d;}
27 consteval const B1 *B2::baz2 (const D *d) const {return d;}
30 test (const B1 *b1, const B2 *b2, const D *d)
32 if (b1->foo1 () != b1)
34 if (b2->baz1 () != b2)
36 if (b1->foo2 (d) != b2)
38 if (b2->baz2 (d) != b1)
58 constexpr auto e = test (&d, &d, &d);
59 constexpr auto f = test (&d);
60 static_assert (e == 0);
61 static_assert (f == 0);