This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

No Subject


//
// This is really a strange bug, I was unable to focus it better
// gcc version egcs-2.90.17 971114 (gcc2-970802 experimental)
// alpha-dec-osf4.0
// there is something wrong in virtual functions
//

class base;
class Expr;
class Plus;

class base_iterator {};

template <class T> class binary_iterator : public base_iterator {};

class Expr {
public :
	Expr() {};	
	Expr(const base*){};
};

class base
{

public :
	
	virtual double& output(double& stream) const = 0;
	virtual base_iterator& begin()	const	
				{ return * new base_iterator;	};
	virtual Expr power() const;
        virtual Expr operator-(const base& in) const {return this;};
	
};


class binary : public base {

public :
	double& output(double& stream) const { return stream;};
	binary_iterator<int>& begin() 	const
		{ return * new binary_iterator<int>(); };
			
};

class Plus : public binary {
public :
	double& output(double& stream) const
		{ return this->binary::output(stream); };	
};

class Minus : public binary {
public:	
	double& output(double& stream) const 
		{ return static_cast<const binary*>(this)->output(stream); };	
};

Expr base::power() const	{ return new Plus; };

void main(){Expr	a = new Plus; }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]