help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

problem with templates under gcc 3.4.2


From: Salem
Subject: problem with templates under gcc 3.4.2
Date: 24 May 2005 02:55:26 -0700
User-agent: G2/0.2

Hi everybody,
   I appreciate your advice and help on the following compilation
problem I have with gcc 3.4.2-6 which comes with Fedora Core 3. Using
gcc 3.2.3 or 3.3, the code compiles with no problem. For the following
piece of code:

#include <stdlib.h>

template <class T>
class B {
public:
  B() {}
protected:
  int* state;
};

template <class T>
class C : public B<T> {
public:
  C() {
    state = NULL;
  }
};

int main() {
  C<int> c();
  return 0;
}

I get an error message on line "state = NULL". It says that "state" is
undeclared. However, when I replace that line with "this->state =
NULL", the compiler doesn't complain anymore.

Is this a compiler bug? Is this about a new C++ standard enforced in
gcc 3.4.x?  Once again, I appreciate your time.

Regards,
--Salem



reply via email to

[Prev in Thread] Current Thread [Next in Thread]