E
eknecronzontas
Hello!
Below is a snippet that compiles in 3.3.3, but not in 3.4.4.
Obviously, this is a result of the (laudable) efforts to make gcc more
standards-compliant. Any way to get around this? gcc 3.4.4 complains
that x is undeclared in the template definition.
Thanks,
Andrew Steiner
-----------------------------------------------------------------------
#include <iostream>
using namespace std;
class parent {
public:
parent() { x=3.0; };
double x;
};
template<class parent_t> class child : public parent_t {
public:
void test() {
cout << x << endl;
}
};
int main(void) {
child<parent> c;
c.test();
return 0;
}
Below is a snippet that compiles in 3.3.3, but not in 3.4.4.
Obviously, this is a result of the (laudable) efforts to make gcc more
standards-compliant. Any way to get around this? gcc 3.4.4 complains
that x is undeclared in the template definition.
Thanks,
Andrew Steiner
-----------------------------------------------------------------------
#include <iostream>
using namespace std;
class parent {
public:
parent() { x=3.0; };
double x;
};
template<class parent_t> class child : public parent_t {
public:
void test() {
cout << x << endl;
}
};
int main(void) {
child<parent> c;
c.test();
return 0;
}