This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: compile error on template using gcc 3.4.4 that worked for gcc 3.3.x
- From: Ian Lance Taylor <iant at google dot com>
- To: "Karl Kobata" <karl dot kobata at syncira dot com>
- Cc: <gcc-help at gcc dot gnu dot org>
- Date: 09 May 2007 16:59:13 -0700
- Subject: Re: compile error on template using gcc 3.4.4 that worked for gcc 3.3.x
- References: <5p5kll$fhd0n@rrcs-agw-02.hrndva.rr.com>
"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