compile error on template using gcc 3.4.4 that worked for gcc 3.3.x
Ian Lance Taylor
iant@google.com
Wed May 9 23:59:00 GMT 2007
"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
More information about the Gcc-help
mailing list