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 { ShapeShape7 Shape() {} ~ShapeShape8 virtual ~Shape() {} 9 }; 10 11 struct Loop 12 { LoopLoop13 Loop() {} ~LoopLoop14 virtual ~Loop() {} funcLoop15 virtual void func() {} 16 }; 17 18 struct Rect : 19 public Shape, 20 public Loop 21 { RectRect22 Rect() {} ~RectRect23 virtual ~Rect() {} 24 }; 25 main()26int main () 27 { 28 const Rect* rect = new Rect(); 29 Loop &l = ((Loop&)(*rect)); 30 return (&l != (const Loop *)rect); 31 } 32