public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Karl Kobata" <karl.kobata@syncira.com>
To: "'Ian Lance Taylor'" <iant@google.com>
Cc: <gcc-help@gcc.gnu.org>
Subject: RE: compile error on template using gcc 3.4.4 that worked for gcc 3.3.x
Date: Fri, 11 May 2007 22:03:00 -0000	[thread overview]
Message-ID: <5p5klh$h9uto@rrcs-agw-01.hrndva.rr.com> (raw)
In-Reply-To: <m34pml35wu.fsf@localhost.localdomain>

Ian,

You are correct.  I added "this->".  It corrected the errors I was getting.

Thanks very much.
karl

-----Original Message-----
From: Ian Lance Taylor [mailto:iant@google.com] 
Sent: Wednesday, May 09, 2007 4:59 PM
To: Karl Kobata
Cc: gcc-help@gcc.gnu.org
Subject: 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

      reply	other threads:[~2007-05-11 22:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-09  3:22 Karl Kobata
2007-05-09 23:59 ` Ian Lance Taylor
2007-05-11 22:03   ` Karl Kobata [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='5p5klh$h9uto@rrcs-agw-01.hrndva.rr.com' \
    --to=karl.kobata@syncira.com \
    --cc=gcc-help@gcc.gnu.org \
    --cc=iant@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).