1 /* { dg-do compile } */ 2 /* { dg-options "-O3 -fno-early-inlining" } */ 3 4 struct data { datadata5 data(int) {} 6 }; 7 8 struct top { topftop9 virtual int topf() {} 10 }; 11 12 struct intermediate: top { topfintermediate13 int topf() /* override */ { return 0; } 14 }; 15 16 struct child1: top { childfchild117 void childf() 18 { 19 data d(topf()); 20 } 21 }; 22 23 struct child2: intermediate {}; 24 test(top & t)25void test(top& t) 26 { 27 child1& c = static_cast<child1&>(t); 28 c.childf(); 29 child2 d; 30 test(d); 31 } 32 main(int argc,char ** argv)33int main (int argc, char **argv) 34 { 35 child1 c; 36 test (c); 37 return 0; 38 } 39