Bug 49145 - g++ reports an incorrect parse error
g++ reports an incorrect parse error
Product: Red Hat Linux
Classification: Retired
Component: gcc (Show other bugs)
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
David Lawrence
Depends On:
  Show dependency treegraph
Reported: 2001-07-15 13:08 EDT by Eric Crampton
Modified: 2007-04-18 12:34 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2001-07-15 13:08:34 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Eric Crampton 2001-07-15 13:08:30 EDT
Consider the following simple code:

#include <list>

typedef std::list<int> Int_List;

int main()
  Int_List i;

  Int_List::const_iterator bitor, eitor;
  for (bitor = i.begin(), eitor = i.end();
       bitor != eitor;

This code doesn't compile with the g++ supplied with RedHat 7.1 or the 
g++ in updates as of 7/15/2001. I get the following output:

[eric@localhost /tmp]$ g++ -v
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/2.96/specs
gcc version 2.96 20000731 (Red Hat Linux 7.1 2.96-85)
[eric@localhost /tmp]$ g++ -c test.cpp
test.cpp: In function `int main ()':
test.cpp:9: parse error before `|'
test.cpp:10: parse error before `|'

This code, however, does compile with g++ 2.95.3:

[eric@localhost /tmp]$ g++ -v
Reading specs from 
gcc version 2.95.3 20010315 (release)
[eric@localhost /tmp]$ g++ -c test.cpp
[eric@localhost /tmp]$
Comment 1 Jakub Jelinek 2001-07-16 14:52:47 EDT
That program is not valid C++. bitop and other things are reserved,
e.g. bitop is another spelling of |.
You can pass -fno-operator-names if you want this to compile.

Note You need to log in before you can comment on or make changes to this bug.