Debian Codegraph @

gcc/testsuite/g++.old-deja/g++.jason/ref8.C

raw
1 // { dg-do run }
2 // PRMS Id: 5184
3 // Bug: cast to C& below does not adjust address
4
5 struct A {};
6 struct B {
7 virtual void foo () {}
8 };
9 struct C : public B, public A {};
10
11 int main() {
12 C c;
13
14 A& ar = c;
15 C& cr = (C&)ar;
16
17 cr.foo(); // this line causes core dump
18 }