This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
member-template bug in egcs
- To: egcs-bugs at cygnus dot com
- Subject: member-template bug in egcs
- From: Klaus-Georg Adams <Klaus-Georg dot Adams at chemie dot uni-karlsruhe dot de>
- Date: Wed, 19 Nov 1997 15:06:20 +0100
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
-------------------------------------------------------------------------