member-template bug in egcs

Klaus-Georg Adams Klaus-Georg.Adams@chemie.uni-karlsruhe.de
Wed Nov 19 09:56:00 GMT 1997


> Seems like you just can't do it with egcs :-( :-(

Well, there should be a way, otherwise how would you implement a
working auto_ptr?
Take a look in $(prefix)/include/g++/memory. If you fix the obvious
typos and compile something like

#include <memory>

int main()
{
	auto_ptr<int> pi( new int );
	auto_ptr<long> pl( new long );
	pi = pl;
	return 0;
}

which is supposed to work according to the CD2, you get the same
errors.

BTW: Scott Meyers offers a sample implementation of auto_ptr at
http://cseng.aw.com/bookdetail.qry?ISBN=0-201-63371-X&ptype=634
which uses

template<class X> class auto_ptr {
	template<class Y> friend class auto_ptr;
public:

That would be nice to have :-)

-- kga
-------------------------------------------------------------------------
Klaus-Georg Adams        Email: Klaus-Georg.Adams@chemie.uni-karlsruhe.de
Institut f. Anorg. Chemie II                           Tel: 0721 608 3485
Uni Karlsruhe
-------------------------------------------------------------------------



More information about the Gcc-bugs mailing list