[gnu.g++.bug] G++ doesn't like struct's called main

schmidt%blanche.ics.uci.edu@ORION.CF.UCI.EDU ("Douglas C. Schmidt") (10/11/88)

Hi,

  I'm not sure if this is a bug or a feature, but g++ 1.27 doesn't
like struct's (or classes) called ``main.''  The code below gets a
parse error from 1.27.  It compiles and executes ``correctly'' using
AT&T CC 1.2.1 and gcc 1.28.

----------------------------------------
struct main {
   int foo;
};

struct main Init_Code;

main() {
   printf ( "hello world\n" );
}
----------------------------------------

Here are the diagnostics:

----------------------------------------
g++ version 1.27.0
 echo use .cc filename extension!
use .cc filename extension!
 /usr/public/lib/g++/gcc-cpp+ -v -I/cd/ua/schmidt/include/ -undef -D__GNU__ -D__GNUG__ -Dsparc -Dsun -Dunix -+ test.c /tmp/cca00108.cpp
GNU CPP version 1.27.0
 /usr/public/lib/g++/gcc-c++ /tmp/cca00108.cpp -quiet -dumpbase test.c -fchar-charconst -version -o /tmp/cca00108.s
test.c:7: parse error before `{'
test.c:7: cannot open file parse.output
GNU C++ version 1.27.0 (sparc) compiled by GNU C version 1.28.
State is 256, input token number is 123.
----------------------------------------

Doug