[gnu.g++.bug] g++ 1.27 fails to accept valid C and C++ construct.

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

Hi,

   The following short program does not compile under g++ 1.27.
However, I believe that it is valid ANSI-C, and it works under both
gcc and AT&T's CC 1.2.1.  After all, a[i] is *obviously* equivalent to
i[a] ;-)...

----------------------------------------
#include <stdio.h>

main ( int argc, char **argv ) {
   for ( ; *argv; argv++) {
      int i;
      for ( i = 0; i [ *argv ]; i++ ) {
         putchar( i [ *argv ] );
      }
      putchar( '\n' );
   }
}
----------------------------------------

The compiler diagnostic is:

----------------------------------------
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/cca21732.cpp
GNU CPP version 1.27.0
 /usr/public/lib/g++/gcc-c++ /tmp/cca21732.cpp -quiet -dumpbase test.C
-fchar-charconst -noreg -version -o /tmp/cca21732.s

test.C:6: [] applied to non-pointer type
test.C:7: [] applied to non-pointer type
test.C:7: [] applied to non-pointer type
GNU C++ version 1.27.0 (sparc) compiled by GNU C version 1.28.
----------------------------------------

thanks,

Doug
----------------------------------------
schmidt@bonnie.ics.uci.edu (ARPA) |   Per me si va nella cita dolente.
                                  |   Per me si va nell' etterno dolore.
                                  |   Per me si va tra la perduta gente.
                                  |   Lasciate ogni speranza voi ch' entrate.