This is the mail archive of the gcc-help@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: compile error on template using gcc 3.4.4 that worked for gcc 3.3.x


"Karl Kobata" <karl.kobata@syncira.com> writes:

> ============== source that is erroring ===============
> 36 template<class T> class OutputBuffer : public Buffer<T> {
> 37 public:
> 38 ÂÂÂvirtual int Flush() = 0;
> 39Â ÂÂvirtual int Put(const T& t) { *pt++ = t; return pt >= end ? Flush() :
> 0; }
> 40 ÂÂÂOutputBuffer(unsigned int sz):Buffer<T>(sz) { pt = base; }
> 41 ÂÂÂOutputBuffer(T* b, unsigned int sz):Buffer<T>(b, sz) { pt = base; }
> 42 ÂÂÂOutputBuffer() { pt = base; }
> 43 ÂÂÂ~OutputBuffer() {}
> 44 };
> 
> ========== error messages using gcc 3.4.4 =================
> /home/AppsTest/MGen/MgenLibrary/aeg/include/generic/buffer.h:39: error: `pt'
> undeclared (first use this function)

I don't see any declaration of 'pt' in the above code snippet.

If 'pt' is declared in the base class, then you need to say
"this->pt".  To see why, search the net for "two-phase lookup."  gcc
3.4 implemented a new C++ parser which is much more standards
compliant.

Ian


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