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]

member-template bug in egcs



I believe the following program should compile:

template <class T> class t {
public:
	template <class T2> void access( const t<T2>& x ) { data = x.data; }
private:
	int data;
};

int main()
{
	t<int> one;
	t<long> two;
	one.access( two );
	return 0;
}

egcs (971105 and 971114) complains:

/egcs/egcs/bin/g++ -o tt tt.C
tt.C: In method `void t<int>::access(const class t<long int> &)':
tt.C:3: member `data' is a private member of class `t<long int>'

Should I be wrong and egcs right, what would be the appropriate friend
declaration to poke this through egcs?

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


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