1/* { dg-do compile } */ 2/* { dg-options "-O3 -fno-ipa-cp -fdump-ipa-inline-details -fno-early-inlining -fdump-tree-optimized" } */ 3struct A { 4 virtual int foo(){return 1;} 5}; 6struct B:A { 7 virtual int foo(){return 2;} 8}; 9static void 10test (struct A *a) 11{ 12 if (a->foo() != 2) 13 __builtin_abort (); 14} 15int 16m() 17{ 18 struct A *a = new B; 19 test (a); 20 return 0; 21} 22 23/* { dg-final { scan-ipa-dump-times "Discovered a virtual call to a known target\[^\\n\]*B::foo" 1 "inline" } } */ 24/* { dg-final { scan-tree-dump-not "OBJ_TYPE_REF" "optimized" } } */ 25/* { dg-final { scan-tree-dump-not "abort" "optimized" } } */ 26/* { dg-final { cleanup-ipa-dump "inline" } } */ 27/* { dg-final { cleanup-tree-dump "optimized" } } */ 28