------- Comment #11 from relf at os2 dot ru 2006-01-24 02:38 ------- Let's change returning type of friend operator+ in the original example to foo<blah>, i.e.,
=====
template <class blah>
class foo;
template <class blah>
foo<blah> operator+(int, foo<blah>);
template <class blah>
class foo {
public:
void operator+(int){}
friend foo ::operator+ <>(int, foo);
};
template <class blah>
foo<blah> operator+(int, foo<blah>){}
int main()
{
foo<double> inst;
inst+1;
1+inst;
};
=====
Then g++ 4.0.3 reports weird error:\
a.cpp:11: error: non-template 'operator+' used as template
a.cpp:11: note: use 'foo<blah>::template operator+' to indicate that it is a
template
a.cpp:11: error: declaration of 'operator+' as non-function
What is wrong here? Should this behavior be filed as a separate bugreport?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17122
