This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [3.4.2 and 3.4.3] Cannot access protected member from a template derived class



On Dec 8, 2004, at 4:23 PM, Stephane Ouellette wrote:


Folks,

I am pretty new at compiling GCC, so I would like to know if anyone has ever seen something like this. The attached program compiles cleanly under g++ 3.3.2 but fails to compile under g++ 3.4.2 and 3.4.3.

Did you read the changes page for 3.4.x?


Your code is invalid C++.
Do the following instead:
template<class T>
class DerivedClassThatDoesNotWork : public MiddleClass<T>
{
 public:
  DerivedClassThatDoesNotWork(int x, T y) : MiddleClass<T>(x, y)
    {
      this->V = 5;
	  /* or this: */
	  MiddleClass<T>::V = 5;
    }
};


Thanks, Andrew Pinski


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]