public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Template members
@ 1998-02-12 20:07 David Greene
  1998-02-13  2:04 ` Alexandre Oliva
  1998-02-13  2:28 ` Mark Mitchell
  0 siblings, 2 replies; 4+ messages in thread
From: David Greene @ 1998-02-12 20:07 UTC (permalink / raw)
  To: egcs

A quick question on template member syntax, and whether
egcs is behaving correctly:

I have a line of code that looks like this (e is an STL
iterator):

myAttribute attr = (*e).getNode()->getAttribute<myAttribute>();

egcs complains about a parse error before `>'.

myAttribute is defined in a header file included by the source
file.  This worked before I used template members to get at
attributes (direct request to the attribute manager object).

Is my code incorrect, or is this a bug in egcs?  I couldn't
find anything in [3rd] to indicate that this would be a problem.

                                      -Dave


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Template members
  1998-02-12 20:07 Template members David Greene
@ 1998-02-13  2:04 ` Alexandre Oliva
  1998-02-13  2:28 ` Mark Mitchell
  1 sibling, 0 replies; 4+ messages in thread
From: Alexandre Oliva @ 1998-02-13  2:04 UTC (permalink / raw)
  To: greened; +Cc: egcs

David Greene writes:

> A quick question on template member syntax, and whether
> egcs is behaving correctly:

It is.

> I have a line of code that looks like this (e is an STL
> iterator):

> myAttribute attr = (*e).getNode()->getAttribute<myAttribute>();

The `template' keyword is mandatory just after `->' when you
explicitly specify template arguments for a template member function,
in order to disambiguate.  If it is missing, the expression must be
parsed as:

(((*e).getNode()->getAttribute) < (myAttribute)) > ()

that is, `<' is taken as a less-than operator.

-- 
Alexandre Oliva
mailto:oliva@dcc.unicamp.br mailto:aoliva@acm.org
http://www.dcc.unicamp.br/~oliva
Universidade Estadual de Campinas, SP, Brasil

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Template members
  1998-02-12 20:07 Template members David Greene
  1998-02-13  2:04 ` Alexandre Oliva
@ 1998-02-13  2:28 ` Mark Mitchell
  1 sibling, 0 replies; 4+ messages in thread
From: Mark Mitchell @ 1998-02-13  2:28 UTC (permalink / raw)
  To: greened; +Cc: egcs

>>>>> "David" == David Greene <greened@eecs.umich.edu> writes:

    David> A quick question on template member syntax, and whether
    David> egcs is behaving correctly:

    David> I have a line of code that looks like this (e is an STL
    David> iterator):

    David> myAttribute attr =
    David> (*e).getNode()->getAttribute<myAttribute>();

Your code is incorrect.  You need to say:

  (*e).getNode()->template getAttribute<myAttribute>();

    David> egcs complains about a parse error before `>'.

    David> myAttribute is defined in a header file included by the
    David> source file.  This worked before I used template members to
    David> get at attributes (direct request to the attribute manager
    David> object).

    David> Is my code incorrect, or is this a bug in egcs?  I couldn't
    David> find anything in [3rd] to indicate that this would be a
    David> problem.

    David>                                       -Dave

-- 
Mark Mitchell		mmitchell@usa.net
Stanford University	http://www.stanford.edu


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Template members
       [not found] <Pine.LNX.3.96.980212122117.11321A-100000.cygnus.egcs@drakh.eecs.umich.edu>
@ 1998-02-12 22:51 ` Jason Merrill
  0 siblings, 0 replies; 4+ messages in thread
From: Jason Merrill @ 1998-02-12 22:51 UTC (permalink / raw)
  To: greened, egcs

>>>>> David Greene <greened@eecs.umich.edu> writes:

> myAttribute attr = (*e).getNode()->getAttribute<myAttribute>();

try

myAttribute attr = (*e).getNode()->template getAttribute<myAttribute>();

Jason

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1998-02-13  2:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-02-12 20:07 Template members David Greene
1998-02-13  2:04 ` Alexandre Oliva
1998-02-13  2:28 ` Mark Mitchell
     [not found] <Pine.LNX.3.96.980212122117.11321A-100000.cygnus.egcs@drakh.eecs.umich.edu>
1998-02-12 22:51 ` Jason Merrill

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).