public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Daniel Llorens del Río" <daniel.llorensdelrio@epfl.ch>
To: Peng Yu <pengyu.ut@gmail.com>,  gcc-help@gcc.gnu.org
Subject: Re: Problem when using template as the base class?
Date: Sat, 23 Sep 2006 04:47:00 -0000	[thread overview]
Message-ID: <22D36039-71C3-4DD6-A76F-08F05BD0F04D@epfl.ch> (raw)
In-Reply-To: <366c6f340609221647o49613c18o86bb2b84986f7890@mail.gmail.com>


On 23 Sep, 2006, at 1:47, Peng Yu wrote:

>> I have the following program. It also includes the non-template
>> equivalent class, which works fine. If you uncomment the comments,  
>> you
>> will see the compiler errors. The errors are also shown below. Do you
>> know what is wrong? Is it a bug of the compiler?
>>
>> BTW, I use g++-3.4.
>
> I corrected the error by adding template keyword. But I don't
> understand why "template" keyword is need. Would you please help me?

Because when the compiler first parses your function, it doesn't know  
what type T is, and so it cannot know that 'T::(something).as' is a  
template and 'T::(something)/as<int>' is valid syntax.

This is standard C++, go google up 'templates two-phase name lookup'.

	Daniel.

      reply	other threads:[~2006-09-23  4:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-22 19:50 Peng Yu
2006-09-22 23:47 ` Peng Yu
2006-09-23  4:47   ` Daniel Llorens del Río [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=22D36039-71C3-4DD6-A76F-08F05BD0F04D@epfl.ch \
    --to=daniel.llorensdelrio@epfl.ch \
    --cc=gcc-help@gcc.gnu.org \
    --cc=pengyu.ut@gmail.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).