public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/9973: parse error with legal code
@ 2003-03-06  2:46 scmvs
  0 siblings, 0 replies; 2+ messages in thread
From: scmvs @ 2003-03-06  2:46 UTC (permalink / raw)
  To: gcc-gnats


>Number:         9973
>Category:       c++
>Synopsis:       parse error with legal code
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Thu Mar 06 02:46:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     scmvs@cs.cf.ac.uk
>Release:        g++ (GCC) 3.2 (mingw special 20020817-1)
>Organization:
>Environment:
Win2K
>Description:
code
========
struct B {
template<class Q> void foo(Q x) { x.apply<int>(); }
};
========
produces

0.cpp: In member function `void B::foo(Q)':
0.cpp:13: parse error before `;' token
>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


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

* Re: c++/9973: parse error with legal code
@ 2003-03-06 14:05 lerdsuwa
  0 siblings, 0 replies; 2+ messages in thread
From: lerdsuwa @ 2003-03-06 14:05 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, nobody, scmvs

Synopsis: parse error with legal code

State-Changed-From-To: open->closed
State-Changed-By: lerdsuwa
State-Changed-When: Thu Mar  6 14:05:00 2003
State-Changed-Why:
    Not a bug.  You have to write
    
      x.template apply<int>();
    
    instead.  Since 'x' depends on template parameter 'Q',
    the compiler don't know that 'apply' is really a template unless the 'template' keyword is given before 'apply'.
    Without this keyword, '<' is treated as a less-than operator.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9973


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

end of thread, other threads:[~2003-03-06 14:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-06  2:46 c++/9973: parse error with legal code scmvs
2003-03-06 14:05 lerdsuwa

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