summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/abi/vbase15.C
blob: a0908f40e54f288a59a603336d5bb91c6f3a630c (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
28
29
30
 // { dg-do run }

struct Spec

{
 virtual int id () const = 0;
};
class D1_1_Spec :  public virtual Spec { };
class D1_2_Spec :  public virtual Spec { };
class D1_3_Spec :  public virtual Spec { };
class D2_1_Spec : public D1_1_Spec, public D1_2_Spec { };
class D2_Spec : public virtual D2_1_Spec, public virtual D1_3_Spec { };

struct D3_Spec : public D2_Spec
{
 virtual int id () const { return 3; }

};

__attribute__((noinline)) void foo(D3_Spec* spec)
{
  spec->id();
}

int main()
{
 D3_Spec spec;
 foo(&spec);
 return 0;
}