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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [g++.dg/] [abi/] [covariant3.C] - Blame information for rev 841

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
// { dg-do run }
2
 
3
// Copyright (C) 2003 Free Software Foundation, Inc.
4
// Contributed by Nathan Sidwell 12 Dec 2003 
5
// Origin:  grigory@stl.sarov.ru
6
 
7
// PR c++/13118. Missing covariant thunk.
8
 
9
struct c0 {};
10
struct c1 : virtual c0 {
11
  virtual c0* f6();
12
};
13
 
14
struct c5 {
15
    virtual void foo();
16
};
17
 
18
struct c10 : virtual c1 {
19
    virtual void foo();
20
};
21
 
22
struct c1a : c1 {}; // disambiguation
23
 
24
struct c11 : virtual c10, c1a {
25
  int i;
26
  virtual c1* f6 () = 0;
27
};
28
 
29
struct c18 : c5, virtual c1 {
30
    virtual void bar();
31
};
32
 
33
struct c28 : virtual c0, virtual c11 {
34
    virtual c18* f6();
35
};
36
 
37
c0 *c1::f6 () {}
38
void c5::foo () {}
39
void c10::foo () {}
40
void c18::bar () {}
41
 
42
c18 ret;
43
 
44
c18 *c28::f6 ()
45
{
46
  return &ret;
47
}
48
 
49
bool check_c1 (c1 *ptr)
50
{
51
  c0 *r = ptr->f6 ();
52
  return r != &ret;
53
}
54
bool check_c10 (c10 *ptr)
55
{
56
  c0 *r = ptr->f6 ();
57
  return r != &ret;
58
}
59
bool check_c11 (c11 *ptr)
60
{
61
  c1 *r = ptr->f6 ();
62
  return r != &ret;
63
}
64
bool check_c28 (c28 *ptr)
65
{
66
  c18 *r = ptr->f6 ();
67
  return r != &ret;
68
}
69
 
70
int main ()
71
{
72
  c28 obj;
73
 
74
  if (check_c1 (static_cast (&obj)))
75
    return 1;
76
  if (check_c1 (static_cast (&obj)))
77
    return 2;
78
  if (check_c10 (&obj))
79
    return 3;
80
  if (check_c11 (&obj))
81
    return 4;
82
  if (check_c28 (&obj))
83
    return 5;
84
  return 0;
85
}

powered by: WebSVN 2.1.0

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