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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [gcc/] [testsuite/] [g++.old-deja/] [g++.abi/] [empty2.C] - Blame information for rev 154

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
// { dg-do assemble  }
2
 
3
// Copyright (C) 2001 Free Software Foundation, Inc.
4
// Contributed by Nathan Sidwell 12 Apr 2001 
5
 
6
// Check we deal with trailing empty base classes properly
7
 
8
struct A {};
9
struct B1 : A {};
10
struct B2 : A {};
11
struct B3 : A {};
12
struct B4 : A {};
13
struct B5 : A {};
14
struct B6 : A {};
15
struct B7 : A {};
16
struct B8 : A {};
17
 
18
struct C1 : B1
19
{
20
  virtual void Foo () {};
21
};
22
struct C2 : B1, B2
23
{
24
  virtual void Foo () {};
25
};
26
struct C3 : B1, B2, B3
27
{
28
  virtual void Foo () {};
29
};
30
struct C4 : B1, B2, B3, B4
31
{
32
  virtual void Foo () {};
33
};
34
struct C5 : B1, B2, B3, B4, B5
35
{
36
  virtual void Foo () {};
37
};
38
struct C6 : B1, B2, B3, B4, B5, B6
39
{
40
  virtual void Foo () {};
41
};
42
struct C7 : B1, B2, B3, B4, B5, B6, B7
43
{
44
  virtual void Foo () {};
45
};
46
struct C8 : B1, B2, B3, B4, B5, B6, B7, B8
47
{
48
  virtual void Foo () {};
49
};
50
 
51
struct D1 : virtual C1 {};
52
struct D2 : virtual C2 {};
53
struct D3 : virtual C3 {};
54
struct D4 : virtual C4 {};
55
struct D5 : virtual C5 {};
56
struct D6 : virtual C6 {};
57
struct D7 : virtual C7 {};
58
struct D8 : virtual C8 {};
59
 
60
unsigned const nearly_empty_size = sizeof (D1);
61
 
62
template  int Check (Dn const &ref)
63
{
64
  if ((sizeof (Cn) <= nearly_empty_size)
65
      != (static_cast  (&ref)
66
          == static_cast  (&ref)))
67
    return 1;
68
  return 0;
69
}
70
 
71
template  int Check ()
72
{
73
  Cn c[2];
74
 
75
  if (static_cast  (static_cast  (&c[1]))
76
      == static_cast  (static_cast  (&c[0])))
77
    return 1;
78
  return 0;
79
}
80
 
81
 
82
int main ()
83
{
84
#if defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100
85
  if (Check ())
86
    return 1;
87
  if (Check ())
88
    return 2;
89
  if (Check ())
90
    return 3;
91
  if (Check ())
92
    return 4;
93
  if (Check ())
94
    return 5;
95
  if (Check ())
96
    return 6;
97
  if (Check ())
98
    return 7;
99
  if (Check ())
100
    return 8;
101
 
102
  if (Check (D1 ()))
103
    return 11;
104
  if (Check (D2 ()))
105
    return 12;
106
  if (Check (D3 ()))
107
    return 13;
108
  if (Check (D4 ()))
109
    return 14;
110
  if (Check (D5 ()))
111
    return 15;
112
  if (Check (D6 ()))
113
    return 16;
114
  if (Check (D7 ()))
115
    return 17;
116
  if (Check (D8 ()))
117
    return 18;
118
 
119
  if (sizeof (C2) == nearly_empty_size)
120
    return 22;
121
  if (sizeof (C3) == nearly_empty_size)
122
    return 23;
123
  if (sizeof (C4) == nearly_empty_size)
124
    return 24;
125
  if (sizeof (C5) == nearly_empty_size)
126
    return 25;
127
  if (sizeof (C6) == nearly_empty_size)
128
    return 26;
129
  if (sizeof (C7) == nearly_empty_size)
130
    return 27;
131
  if (sizeof (C8) == nearly_empty_size)
132
    return 28;
133
#endif
134
  return 0;
135
 
136
}

powered by: WebSVN 2.1.0

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