OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc1/] [gcc/] [testsuite/] [g++.old-deja/] [g++.abi/] [primary.C] - Blame information for rev 338

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 305 jeremybenn
// { dg-do run  }
2
// Test to see that primary bases are selected correctly.
3
// Origin: Mark Mitchell 
4
 
5
#if defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100
6
 
7
// S1 is a nearly-empty base.
8
 
9
struct S1
10
{
11
  virtual void f ()
12
  {
13
  }
14
};
15
 
16
// S2 is a dynamic, but not nearly-empty, base.
17
 
18
struct S2
19
{
20
  virtual void g ()
21
  {
22
  }
23
 
24
  int i;
25
};
26
 
27
// S1 should be the primary base.
28
 
29
struct T1 : public S1, public S2
30
{
31
};
32
 
33
// S2 should be the primary base.
34
 
35
struct T2 : public S2, public S1
36
{
37
};
38
 
39
// S2 should be the primary base.
40
 
41
struct T3 : virtual public S1, public S2
42
{
43
};
44
 
45
// S1 should be the primary base.
46
 
47
struct T4 : virtual public S1, virtual public S2
48
{
49
};
50
 
51
// Check that Y is the primary base for X.  Otherwise, return N.
52
#define CHECK_PRIMARY_BASE(X, Y, N)             \
53
  {                                             \
54
    X x;                                        \
55
    if ((void*) &x != (void *) (Y*) (&x))       \
56
      return N;                                 \
57
  }
58
 
59
int main ()
60
{
61
  CHECK_PRIMARY_BASE (T1, S1, 1);
62
  CHECK_PRIMARY_BASE (T2, S2, 2);
63
  CHECK_PRIMARY_BASE (T3, S2, 3);
64
  CHECK_PRIMARY_BASE (T4, S1, 4);
65
}
66
 
67
#else /* !(defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100) */
68
 
69
int main ()
70
{
71
}
72
 
73
#endif /* !(defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100) */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.