Hi
After upgrading my compiler (gcc-3.3.3 to gcc-4.0.0) I stumbled over an
error that I do not understand. Maybe it is a compiler bug, but maybe I
can get some new insights from this. Here is a small example:
------------------------------------------------------------------
template <class T>
class A {
public:
A (void) {}
template <class X>
A<T>& foo1 (X p) {
// ...
return(*this);
}
template <class X>
class A<T>& foo2 (X p) { // differns from foo1 only by "class"
// ...
return(*this);
}
template <class X>
A& foo3 (X p) {
// ...
return(*this);
}
template <class X>
class A& foo4 (X p) { // differns from foo3 only by "class"
// ...
return(*this);
}
};
----------------------------------------------------------------
gcc-3.3.3 accepts all foos. gcc-4.0.0 (and gcc-3.4.1) accepts all foos
but foo4 (notice: it differs from foo3 only by the keyword "class")[1].
In my understanding they are all identical. If I am wrong, could someone
please explain to me what the difference is?
Thanks and ciao,
Patrick
[1] The error message is "template argument required" and
points to where foo4 is called, not to the member-function iself.
--
Email see: http://user.cs.tu-berlin.de/~rammelt/mail.gif