aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-27.C
blob: 1dcf76cc3c14a76a9c553a9a0885dd05dc532602 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/* { dg-do compile } */
/* { dg-options "-O3 -fdump-ipa-devirt -fdump-tree-optimized"  } */
struct A
 {
   int a;
 };
struct B
 {
  __attribute__ ((visibility("default")))
   virtual int foo(void) {return 42;}
   int b;
 };
struct C: A,B
 {
  __attribute__ ((visibility("hidden")))
   virtual int foo(void);
 };

struct C c;
int test(void)
{
  struct C *d=&c;
  struct B *b=d;
  return d->foo()+b->foo();
}
/* { dg-final { scan-tree-dump "OBJ_TYPE_REF" "optimized"  } } */
/* { dg-final { cleanup-tree-dump "optimized" } } */