?
=?ISO-8859-1?Q?Xavier_D=E9coret?=
I have just come across the following fact.
Names defined in a template superclass of the current template must be
qualified as being from the superclass. Alternatively, you can also
qualify those names by preceding them with this->. An example might be
clearer to read:
template <typename T> struct Base
{
int m;
};
template <typename T> struct Derived : public Base<T>
{
void g()
{
m++; // ERROR: Name not found.
this->m++; // OK
Derived::m++; // OK
Base<T>::m++; // OK
}
};
This appears when migrating from gcc3 to gcc4 (see
http://developer.apple.com/releasen...ortingReleaseNotes/Articles/PortingToGCC.html)
..
My question is: is that conform to the standard (sorry to ask, but I am
not familiar with reading through the standard. This might be trivial to
answer for those who are.)
Names defined in a template superclass of the current template must be
qualified as being from the superclass. Alternatively, you can also
qualify those names by preceding them with this->. An example might be
clearer to read:
template <typename T> struct Base
{
int m;
};
template <typename T> struct Derived : public Base<T>
{
void g()
{
m++; // ERROR: Name not found.
this->m++; // OK
Derived::m++; // OK
Base<T>::m++; // OK
}
};
This appears when migrating from gcc3 to gcc4 (see
http://developer.apple.com/releasen...ortingReleaseNotes/Articles/PortingToGCC.html)
..
My question is: is that conform to the standard (sorry to ask, but I am
not familiar with reading through the standard. This might be trivial to
answer for those who are.)