summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/inherit/operator2.C
blob: 09407e1b48986313e9026c89283b67eb3c498e67 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
typedef int INT_TYPEDEF;

template<class T>
class TypedIfc
{
public:
  virtual ~TypedIfc() { }
  virtual operator const T&() const = 0;
  virtual const T& operator= (const T& t) = 0;
};

template<class Tnative>
class NullIfc : public TypedIfc<Tnative>
{
public:
  const Tnative& operator= (const Tnative& t) { return t; }
  operator const Tnative&() const { return *(Tnative *)0; }
};

typedef TypedIfc<INT_TYPEDEF> INT_TYPEDEFIfc;

NullIfc<int> i32;