OSDN Git Service

* cp-tree.h (cp_id_kind): New type.
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.old-deja / g++.jason / overload33.C
1 // { 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<class T>
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<class T>
54 class SmartPtr : public ConstSmartPtr<T>
55 {
56   public:
57                         SmartPtr(T* theItem)
58                           : ConstSmartPtr<T>(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<Derived>  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 /* ------------------------------------------------------------ */