template inheritance & this->
Grigorio V. Moshkin
grigorio@garant.ru
Tue Feb 1 15:50:00 GMT 2005
Hi!
Consider the following program:
-----------------------------------------
template<class A>
class Base {
public:
A data_a;
int count;
};
template<class A>
class Child: public Base<A> {
public:
void inc() {
this->count++;
this->data_a++; // ISO C++ ok, universal.
Base<A>::count++; // ISO C++ ok.
// Code below is bad!
data_a++; // ISO C++ denies! gcc 3.4.x doesn't compile!
count++; // ISO C++ denies! gcc 3.4.x doesn't compile!
}
};
-------------------------------------
Are the comments fully correct? I.e. ISO C++ really denies that,
and that's the only reason because gcc 3.4.x doesn't compile that?
(gcc 3.3.3 does).
More information about the Gcc-bugs
mailing list