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++.jason/] [overload33.C] - Blame information for rev 338

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 305 jeremybenn
// { dg-do assemble  }
2
// PRMS ID: 7507
3
 
4
/* ------------------------------------------------------------ */
5
 
6
class Base0
7
{
8
public:
9
                                Base0() {}
10
      virtual                   ~Base0() {}
11
};
12
 
13
class Base1
14
{
15
public:
16
                                Base1() {}
17
    virtual                     ~Base1() {}
18
};
19
 
20
class Derived : public Base0, public Base1
21
{
22
public:
23
                                Derived() {}
24
  virtual                       ~Derived() {}
25
};
26
 
27
/* ------------------------------------------------------------ */
28
 
29
class Dummy
30
{
31
  public:
32
                                Dummy(Base0 * theBase) {}
33
                                ~Dummy() {}
34
};
35
 
36
/* ------------------------------------------------------------ */
37
 
38
template
39
class ConstSmartPtr
40
{
41
  T*                    myItem;         // private
42
 
43
  public:
44
                        ConstSmartPtr(T const* theItem);
45
 
46
                        operator T const*() const
47
                                { return myItem; }
48
  protected:
49
    T*                  _item() const
50
                                { return myItem; }
51
};
52
 
53
template
54
class SmartPtr : public ConstSmartPtr
55
{
56
  public:
57
                        SmartPtr(T* theItem)
58
                          : ConstSmartPtr(theItem) {}
59
 
60
    T*                  item() const
61
                                { return this->_item(); }
62
 
63
                        operator T*() const
64
                                { return this->_item(); }
65
};
66
 
67
/* ------------------------------------------------------------ */
68
 
69
void
70
function()
71
{
72
  SmartPtr  myObj = new Derived();
73
 
74
  Dummy th1(myObj);                 // Doesn't work under Cygnus
75
  Dummy th2((Base0 *) myObj);       // Doesn't work either
76
}
77
 
78
/* ------------------------------------------------------------ */

powered by: WebSVN 2.1.0

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