🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by "Douglas C. Schmidt" Sun, 01 Jan 1989 20:57
g++ fails to parse correct C variable definition
#1585
Author: "Douglas C. Schmidt"
Date: Sun, 01 Jan 1989 20:57
39 lines
1683 bytes
Hi,

   The following short C++ program fails to compile with g++ 1.32.
It does compile with gcc 1.32, and also compiles if 

int (*ap)[20]; 

is moved to the outer scope or declared with storage class static.
Interestingly, AT&T cfront 1.2.1 also botches this.

Here's the code:

----------------------------------------
main ( ) {
   int a [ 10 ] [ 20 ];
   int (*ap)[ 20 ];
}
----------------------------------------

And here are the diagnostics:

----------------------------------------
g++ version 1.32.0
 /usr/public/lib/g++/gcc-cpp -+ -v -I/cd/ua/schmidt/include/ -undef
-D__GNU__ -D__GNUG__ -Dsparc -Dsun -Dunix test.c /tmp/cca06496.cpp
GNU CPP version 1.32
 /usr/public/lib/g++/gcc-c++ /tmp/cca06496.cpp -quiet -dumpbase test.c
-fstrength-reduce -finline-functions -fmemoize-lookups -fsave-memoized
-fchar-charconst -version -o /tmp/cca06496.s
GNU C++ version 1.32.0 (sparc) compiled by GNU C version 1.31.
In function int main ():
test.c:5: `ap' was not declared (first use this function)
test.c:5: (Each undeclared identifier is reported only once
test.c:5: for each function it appears in.)
test.c:6: warning: variable `a' never used
----------------------------------------

Doug
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads