Debian Codegraph @

gcc/testsuite/g++.dg/inherit/conv3.C

raw
1 // PR 31074
2 // Bug: The reference cast wasn't finding the desired static_cast followed by
3 // const_cast interpretation.
4
5 struct Shape
6 {
7 Shape() {}
8 virtual ~Shape() {}
9 };
10
11 struct Loop
12 {
13 Loop() {}
14 virtual ~Loop() {}
15 virtual void func() {}
16 };
17
18 struct Rect :
19 public Shape,
20 public Loop
21 {
22 Rect() {}
23 virtual ~Rect() {}
24 };
25
26 int main ()
27 {
28 const Rect* rect = new Rect();
29 Loop &l = ((Loop&)(*rect));
30 return (&l != (const Loop *)rect);
31 }