Bug 49145

Summary: g++ reports an incorrect parse error
Product: [Retired] Red Hat Linux Reporter: Eric Crampton <ericcrampton>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED NOTABUG QA Contact: David Lawrence <dkl>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.1   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2001-07-15 17:08:34 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

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;
       ++bitor)
  {
  }
}

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 
/usr/local/gcc-2.95.3/lib/gcc-lib/i686-pc-linux-gnu/2.95.3/specs
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.