Bug 49145 - g++ reports an incorrect parse error
Summary: g++ reports an incorrect parse error
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: gcc   
(Show other bugs)
Version: 7.1
Hardware: i386 Linux
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: David Lawrence
Depends On:
TreeView+ depends on / blocked
Reported: 2001-07-15 17:08 UTC by Eric Crampton
Modified: 2007-04-18 16:34 UTC (History)
0 users

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

Attachments (Terms of Use)

Description Eric Crampton 2001-07-15 17:08:30 UTC
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 18:52:47 UTC
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.