This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

c++/10603: [3.4 regression] [new parser] failing to print problematic token upon parse error


>Number:         10603
>Category:       c++
>Synopsis:       [3.4 regression] [new parser] failing to print problematic token upon parse error
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Fri May 02 14:06:01 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     pfeifer@dbai.tuwien.ac.at
>Release:        unknown-1.0
>Organization:
>Environment:
gcc version 3.4 20030502 (experimental)
>Description:
Our diagnoses for the following piece of code
used to be

  int f(int not) {
    return 1-not;
  } 

rather confusing, but now the source of the problem really
is very hard to see:

  x.cc:1: error: expected primary-expression
  x.cc:1: error: expected `,' or `;'

(Hint: the problem is that "not" is parsed as "!".)
>How-To-Repeat:
  % /sw/gcc-3.2.2/bin/g++ x.cc
  x.cc:1: parse error before `!' token
  x.cc: In function `int f(...)':
  x.cc:2: parse error before `;' token

  % gccvs x.cc
  x.cc:1: error: expected primary-expression
  x.cc:1: error: expected `,' or `;'
>Fix:
Also provide the token that lead to the parse error, so that
the user can see the actual problem.
>Release-Note:
>Audit-Trail:
>Unformatted:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]