Re: compile error on template using gcc 3.4.4 that worked for gcc 3.3.x

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Karl Kobata" <karl.kobata@xxxxxxxxxxx> 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 of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux