This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: [3.4.2 and 3.4.3] Cannot access protected member from a template derived class
- From: Andrew Pinski <pinskia at physics dot uc dot edu>
- To: Stephane Ouellette <ouellettes at videotron dot ca>
- Cc: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 8 Dec 2004 16:27:05 -0500
- Subject: Re: [3.4.2 and 3.4.3] Cannot access protected member from a template derived class
- References: <41B770C5.4000303@videotron.ca>
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