view gcc/testsuite/g++.dg/inherit/operator2.C @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
line wrap: on
line source

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;