2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / g++.old-deja / g++.jason / overload33.C
blob2cc34c6b2098a1b3885f964ffc2617373fcd8838
1 // { dg-do assemble  }
2 // PRMS ID: 7507
4 /* ------------------------------------------------------------ */
6 class Base0
8 public:
9                                 Base0() {}
10       virtual                   ~Base0() {}
13 class Base1
15 public:
16                                 Base1() {}
17     virtual                     ~Base1() {}
20 class Derived : public Base0, public Base1
22 public:
23                                 Derived() {}
24   virtual                       ~Derived() {}
27 /* ------------------------------------------------------------ */
29 class Dummy
31   public:
32                                 Dummy(Base0 * theBase) {}
33                                 ~Dummy() {}
36 /* ------------------------------------------------------------ */
38 template<class T>
39 class ConstSmartPtr
41   T*                    myItem;         // private
43   public:       
44                         ConstSmartPtr(T const* theItem);
46                         operator T const*() const
47                                 { return myItem; }
48   protected:
49     T*                  _item() const
50                                 { return myItem; }
53 template<class T>
54 class SmartPtr : public ConstSmartPtr<T>
56   public:
57                         SmartPtr(T* theItem)
58                           : ConstSmartPtr<T>(theItem) {}
60     T*                  item() const
61                                 { return this->_item(); }
63                         operator T*() const
64                                 { return this->_item(); }
67 /* ------------------------------------------------------------ */
69 void
70 function()
72   SmartPtr<Derived>  myObj = new Derived();
74   Dummy th1(myObj);                 // Doesn't work under Cygnus
75   Dummy th2((Base0 *) myObj);       // Doesn't work either
78 /* ------------------------------------------------------------ */