Hi, here's a little sample code, which could be compiled with g++ 3.01 under hp-ux, but when compiled with g++ 3.4.6 under linux, following error occured:
sample.c: In member function 'T C2<T>::PROC(T)': sample.c:19: error: 'c1i' was not declared in this scope Compilation was executed with "g++ sample.c" without any further options. Other compiler versions are not existing. Does anyone know why the compilation doesn't work? I have used a similar code under g++ hp-ux which works well. Many thanks in advance Oliver sample.c ---------- #include <stdarg.h> #include <stdlib.h> #include <stdio.h> using namespace std; template <typename T> class C1 { public: T c1i; C1() { c1i = 1.0; }; ~C1() { }; }; template <typename T> class C2 : public C1<T> { public: T c2i; C2() { c2i = 1; }; ~C2() { }; T PROC(T x) { c1i = c2i; }; }; int main(int argc, char **argv) { C1<double> c1; C2<double> c2; return EXIT_SUCCESS; }