summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.jason/overload33.C
blob: 2cc34c6b2098a1b3885f964ffc2617373fcd8838 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
// { dg-do assemble  }
// PRMS ID: 7507

/* ------------------------------------------------------------ */

class Base0
{
public:
				Base0() {}
      virtual			~Base0() {}
};

class Base1
{
public:
				Base1() {}
    virtual			~Base1() {}
};

class Derived : public Base0, public Base1
{
public:
				Derived() {}
  virtual			~Derived() {}
};

/* ------------------------------------------------------------ */

class Dummy
{
  public:
				Dummy(Base0 * theBase) {}
				~Dummy() {}
};

/* ------------------------------------------------------------ */

template<class T>
class ConstSmartPtr
{
  T*			myItem;		// private

  public:	
			ConstSmartPtr(T const* theItem);

			operator T const*() const
				{ return myItem; }
  protected:
    T*			_item() const
				{ return myItem; }
};

template<class T>
class SmartPtr : public ConstSmartPtr<T>
{
  public:
			SmartPtr(T* theItem)
			  : ConstSmartPtr<T>(theItem) {}

    T*			item() const
				{ return this->_item(); }

			operator T*() const
				{ return this->_item(); }
};

/* ------------------------------------------------------------ */

void
function()
{
  SmartPtr<Derived>  myObj = new Derived();

  Dummy th1(myObj);		    // Doesn't work under Cygnus
  Dummy th2((Base0 *) myObj);	    // Doesn't work either
}

/* ------------------------------------------------------------ */