[gnu.g++.bug] g++ ignores static const's in private class section

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

Hi,

  I believe the following is valid C++ code.  cfront 1.2.1 accepts and
executes it correctly.  G++ 1.27 produces the following error message:

----------------------------------------
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 -+ reverse_video.c
/tmp/cca01184.cpp

GNU CPP version 1.27.0
 /usr/public/lib/g++/gcc-c++ /tmp/cca01184.cpp -quiet -dumpbase
reverse_video.c -finline-functions -fmemoize-lookups -fsave-memoized
-fchar-charconst -version -o /tmp/cca01184.s

At top level:
reverse_video.c:19: undeclared variable `MAX_SIZE' (first use here)
GNU C++ version 1.27.0 (sparc) compiled by GNU C version 1.28.
----------------------------------------

However, I believe this usage of static constants is allowed.

Here's the code:

----------------------------------------
#include <stream.h>

int   tgetent( char *bp, char *name );
char *tgetstr( char *id, char **area );
int   tputs( char *cp, int affcnt, int (*outc)( int ) );
char *getlogin ( void );

int putchr( int i ) {
   return ( putchar(i) );
}

class Inverse {

private:

   // g++ seems to ignore this static constant declaration
   static const int MAX_SIZE = 1024;
   char   sbuf [ MAX_SIZE ];
   char  *sp;
   char   bp [ MAX_SIZE ];
   char  *so_start;
   char  *so_end;

public:

   Inverse ( void ): sp ( sbuf ) {
      if ( tgetent ( bp, getenv ( "TERM" ) ) != 1 ) {
         cerr << "error: termcap read failure\n",exit ( 1 );
      }
      so_start = tgetstr ( "so", &sp );
      so_end   = tgetstr ( "se", &sp );
   }

   Inverse& operator () ( char *Buf ) {
      tputs ( so_start, 1, putchr );
      cout << Buf;
      tputs ( so_end, 1, putchr );
      return ( *this );
   }

   friend ostream& operator << ( ostream& s, Inverse &i ) { // dummy function
      ;
   }

};

main ( int argc,char *argv[ ] ) {
   Inverse V;
   
   cout << "hello, you are " << V ( getlogin ( ) ) << "\n";
}