This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
New C++ frontend bug since the big template change.
- To: mark at markmitchell dot com
- Subject: New C++ frontend bug since the big template change.
- From: Klaus-Georg Adams <Klaus-Georg dot Adams at chemie dot uni-karlsruhe dot de>
- Date: Fri, 31 Jul 1998 15:35:18 +0200
- Cc: egcs-bugs at cygnus dot com
The appended source doesn't compile any more:
friend1.C: In function `class mystream & operator >><int>(class mystream &, class a<int> &)':
friend1.C:23: member `amember' is a private member of class `a<int>'
egcs-2.91.47 didn't complain.
Note: If you leave out either the declaration of the specialization of
operator>> for int or the explicit instantiation of class a<int> the
program compiles.
--
-------------------------------------------------------------------------
Klaus-Georg Adams Email: Klaus-Georg.Adams@chemie.uni-karlsruhe.de
Institut f. Anorg. Chemie, Lehrstuhl II Tel: 49(0)721 608 3485
Universität Karlsruhe, D-76128 Karlsruhe
-------------------------------------------------------------------------
class mystream;
// Declare class template a.
template <class T> class a {
public:
friend mystream& operator>> <>( mystream&, a<T>& thea );
private:
T amember;
};
// Declare function template operator>>
template <class T> mystream& operator>>( mystream& s, a<T>& thea );
// Declare specialization for int.
template<> mystream& operator>> <int>( mystream& s, a<int>& thea );
// Explicit instantiation of a<int>
template class a<int>;
// Define operator>><int>
template<> mystream& operator>> <int>( mystream& s, a<int>& thea )
{
thea.amember = 0;
return s;
}