templated friend ostream & operator <<
zvyagin@gams.ihep.su
zvyagin@gams.ihep.su
Tue Aug 31 22:45:00 GMT 1999
Dear gcc developers!
The code (see below) compiles fine with egcs-1.1.2 and does not compile
with gcc-2.95.
I get error message:
bug1.c: In instantiation of `A<int,6>':
bug1.c:15: instantiated from here
bug1.c:8: template-id `operator <<<>' for `operator <<(ostream &, const
A<int,6> &)' does not match any template declaration
bug1.c: In function `int main()':
bug1.c:16: no match for `_IO_ostream_withassign & << A<int,6> &'
... more lines ...
With best wishes,
Alexander Zvyagin.
// --- CUT HERE ---
#include <iostream>
template <class T,T n> class A;
template <class T,T n> ostream &operator << (ostream &o,const A<T,n> &a);
template <class T,T n>
class A { friend ostream &operator << <> (ostream &o,const A<T,n> &a); };
template <class T,T n> ostream &operator << (ostream &o,const A<T,n> &a)
{ return o << __PRETTY_FUNCTION__ << endl; }
main(void)
{
A<int,6> a;
cout << a << endl;
}
// ---- CUT HERE ------
More information about the Gcc-bugs
mailing list