From: grunwald@foobar.cs.colorado.edu (Dirk Grunwald)
Subject: Bug in most recent snapshot
Reply-To: grunwald@foobar.cs.colorado.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Thu, 17 Dec 1992 04:09:01 GMT

This was working fine in the 921211 snapshot.
DECstation, Ultrix-4.2

[foobar-90] g++ -o foo XX.cc
Fifo.h:52: inconsistent return types for method `Fifo' in class `Fifo<int>'
Fifo.cc: In method `Fifo<int>::~Fifo ()':
Fifo.cc:15: Internal compiler error.
Fifo.cc:15: Please report this to `bug-g++@prep.ai.mit.edu'.

File XX.cc
-----------------------------------------------------------------------------
# 1 "test.cc"
# 1 "Fifo.h" 1
# 1 "/srl/Gcc2/lib/g++-include/bool.h" 1 3
enum bool { FALSE = 0, TRUE = 1 };
# 25 "Fifo.h" 2
typedef int Index;
template <class Item>
class Fifo {
    Item *list;
    Index allocatedSize;
    Index listHead;
    Index listTail;
    char *pValid;
    Index listElements;
    Index advance(Index i) {
	return( ((i+1) >= allocatedSize) ? (0) : (i+1) );
    };
public:
    Fifo(int defaultLength = 0);
    virtual ~Fifo();
    virtual void resize(Index howMany);
    virtual void add(Item t);
    virtual bool remove(Item& item);
    virtual bool removeIfFound(Item& item);
    Item& item(Index i) {
	return(list[i]);
    };
    Index  maxIndex() {
	return(allocatedSize);
    };
    virtual bool empty();
    virtual Index size();
};
# 1 "test.cc" 2
# 1 "Fifo.cc" 1
# 1 "Fifo.h" 1
# 69 "Fifo.h"
# 1 "Fifo.cc" 2
# 1 "/srl/Gcc2/lib/g++-include/assert.h" 1 3
extern "C" {
# 1 "/srl/Gcc2/lib/g++-include/stdio.h" 1 3
#pragma interface
# 1 "/srl/Gcc2/lib/g++-include/_G_config.h" 1 3
typedef int _G_clock_t;
typedef short _G_dev_t;
typedef long _G_fpos_t;
typedef short _G_gid_t;
typedef unsigned long _G_ino_t;
typedef unsigned short _G_mode_t;
typedef short _G_nlink_t;
typedef int _G_off_t;
typedef int _G_pid_t;
typedef int _G_ptrdiff_t;
typedef int _G_sigset_t;
typedef unsigned int _G_size_t;
typedef int _G_time_t;
typedef short _G_uid_t;
typedef unsigned int _G_wchar_t;
typedef  int   _G_ssize_t;
typedef char*   _G_va_list;
# 33 "/srl/Gcc2/lib/g++-include/stdio.h" 2 3
extern "C" {
# 1 "/usr/include/stdio.h" 1 3
# 1 "/usr/include/ansi_compat.h" 1 3
# 116 "/usr/include/ansi_compat.h" 3
# 89 "/usr/include/stdio.h" 2 3
typedef unsigned int	size_t;		 
extern	struct	_iobuf {
	int	_cnt;
	char	*_ptr;
	char	*_base;
	int	_bufsiz;
	short	_flag;
	short	_file;
} _iob[3 ];
typedef	struct _iobuf	FILE;
typedef	long	fpos_t;
extern int 	getc( FILE *__stream );
extern int	getchar( void );
extern int	putc( int __c, FILE *__stream);
extern int	putchar( int __c);
extern int	feof( FILE *__stream );
extern int	ferror( FILE *__stream );
extern int	fileno( FILE *__stream );
extern int	_filbuf( FILE *p);
extern int	__hide__flsbuf ( unsigned char x , FILE *p);
typedef char *va_list;
extern void	clearerr( FILE *__stream); 
extern int	fclose( FILE *__stream );
extern FILE *	__hide_fdopen ( int __filedes, char *__type );
extern int	fflush( FILE *__stream );
extern int	fgetc( FILE *__stream );
extern int	fgetpos( FILE *__stream, fpos_t *__pos );
extern char *	fgets( char *__s, int __n, FILE *__stream );
extern FILE *	__hide_fopen ( const char *__filename, const char *__type );
extern int	__hide_fprintf ( FILE *__stream, const char *__format, ... );
extern int	fputc( int __c, FILE *__stream );
extern int	__hide_fputs ( const char *__s, FILE *__stream );
extern size_t	__hide_fread ( void *__ptr, size_t __size,
			size_t __nitems, FILE *__stream ); 
extern FILE *	__hide_freopen ( const char *__filename, const char *__type,
			FILE *__stream );
extern int	__hide_fscanf ( FILE *__stream, const char *__format, ... );
extern int	fseek( FILE *__stream, long __offset, int __ptrname );
extern int	fsetpos( FILE *__stream, const fpos_t *__pos );
extern long	__hide_ftell ( FILE *__stream );
extern size_t	__hide_fwrite ( const void *__ptr, size_t __size,
			size_t __nitems, FILE *__stream );
extern char *	gets( char *__s );	
extern void	__hide_perror ( const char *__s );
extern FILE  *	__hide_popen (const char *__command, const char *__type );
extern int	__hide_printf ( const char *__format, ... );	
extern int	__hide_puts ( const char *__s );	
extern int	remove( const char *__filename );
extern int	rename( const char *__from, const char *__to );
extern void	__hide_rewind ( FILE *__stream );
extern int	__hide_scanf ( const char *__format, ... );	
extern void	__hide_setbuf ( FILE *__stream, char *__buf );
extern int	__hide_setvbuf ( FILE *__stream, char *__buf,
			int __type, size_t __size );
extern int	__hide_sscanf ( const char *__s, const char *__format, ... );
extern FILE *	tmpfile( void );	
extern char *	tmpnam( char *__s );
extern int	ungetc( int __c, FILE *__stream );
extern int	__hide_vfprintf ( FILE *__stream, const char *__format, va_list __ap );
extern int	__hide_vprintf ( const char *__format, va_list __ap );
extern int	__hide_vsprintf ( char *__s, const char *__format, va_list __ap);
extern char *	__hide_tempnam ( const char *__dir, const char *__pfx);
extern int	__hide_putw ( int __w, FILE *__stream );
extern int	getw(FILE *__stream);
extern int	pclose( FILE *__stream );
# 298 "/usr/include/stdio.h" 3
extern int	__hide_sprintf ( char *__s, const char *__format, ... );
# 69 "/srl/Gcc2/lib/g++-include/stdio.h" 2 3
}
extern "C" {
int    fclose(FILE*);
FILE*  fdopen(int, const char*);
int    fflush(FILE*);
int    fgetc(FILE*);
char*  fgets(char*, int, FILE *);
FILE*  fopen(const char*, const char*);
int    fprintf(FILE*, const char* ...);
int    fputc(int, FILE*);
int    fputs(const char*, FILE*);
_G_size_t  fread(void*, _G_size_t , _G_size_t , FILE*);
FILE*  freopen(const char*, const char*, FILE*);
int    fscanf(FILE*, const char* ...);
int    fseek(FILE*, long, int);
long   ftell(FILE *);
_G_size_t  fwrite(const void*, _G_size_t , _G_size_t , FILE*);
char*  gets(char*);
int    getw(FILE*);
int    pclose(FILE*);
void   perror(const char*);
FILE*  popen(const char*, const char*);
int    printf(const char* ...);
int    puts(const char*);
int    putw(int, FILE*);
int    rewind(FILE*);
int    scanf(const char* ...);
void   setbuf(FILE*, char*);
void   setbuffer(FILE*, char*, int);
int    setlinebuf(FILE*);
int    setvbuf(FILE*, char*, int, _G_size_t );
int    sscanf(char*, const char* ...);
FILE*  tmpfile();
int    ungetc(int, FILE*);
int    vfprintf (...) ;
int    vprintf (...) ;
char*  sprintf (...) ;
char*  vsprintf (...) ;
extern int _filbuf (...) ;
extern int _flsbuf (...) ;
}
# 8 "/srl/Gcc2/lib/g++-include/assert.h" 2 3
# 1 "/srl/Gcc2/include/assert.h" 1 3
# 19 "/srl/Gcc2/include/assert.h" 3
extern "C" {
extern void __eprintf (const char *, const char *, unsigned, const char *);
}
# 50 "/srl/Gcc2/include/assert.h" 3
# 9 "/srl/Gcc2/lib/g++-include/assert.h" 2 3
}
# 2 "Fifo.cc" 2
# 1 "/srl/Gcc2/lib/g++-include/bool.h" 1 3
# 3 "Fifo.cc" 2
# 1 "/srl/Gcc2/lib/g++-include/memory.h" 1 3
# 1 "/srl/Gcc2/lib/g++-include/stddef.h" 1 3
extern "C" {
# 1 "/srl/Gcc2/lib/gcc-lib/mips-dec-ultrix/2.3.2/include/stddef.h" 1 3
# 43 "/srl/Gcc2/lib/gcc-lib/mips-dec-ultrix/2.3.2/include/stddef.h" 3
typedef long int ptrdiff_t;
# 115 "/srl/Gcc2/lib/gcc-lib/mips-dec-ultrix/2.3.2/include/stddef.h" 3
typedef __wchar_t wchar_t;
# 179 "/srl/Gcc2/lib/gcc-lib/mips-dec-ultrix/2.3.2/include/stddef.h" 3
# 7 "/srl/Gcc2/lib/g++-include/stddef.h" 2 3
}
# 6 "/srl/Gcc2/lib/g++-include/memory.h" 2 3
extern "C" {
void*     memalign (...) ;
void*     memccpy (...) ;
void*     memchr (...) ;
int       memcmp (...) ;
void*     memcpy (...) ;
void*     memmove (...) ;
void*     memset (...) ;
int       ffs (...) ;
_G_size_t    getpagesize (...) ;
void*     valloc (...) ;
void      bcopy (...) ;
int       bcmp (...) ;
void      bzero (...) ;
}
# 4 "Fifo.cc" 2
template <class Item>
Fifo<Item>::Fifo(int defaultLength)
{
    listHead = listTail = 0;
    listElements = 0;
    allocatedSize = 0;
    list = 0;
    pValid = 0;
    if (defaultLength > 0) {
	resize(defaultLength);
    }
}
template <class Item>
Fifo<Item>::~Fifo()
{
    if (allocatedSize > 0) {
	delete list;
	delete pValid;
    }
}
template <class Item>
void Fifo<Item>::resize(Index howMuch)
{
    if (howMuch > listElements) {
	Item *p = new Item[howMuch];
	char *validP = new char[howMuch];
	((void) (( p != 0 && validP != 0) ? 0 : (__eprintf ("%s:%u: failed assertion `%s'\n",	 "Fifo.cc",  70, "p != 0 && validP != 0"), 0) )) ;
	bzero((void *) p, sizeof(Item) * howMuch);
	bzero((void *) validP, sizeof(char) * howMuch);
	if (listElements > 0) {
	    ((void) (( list != 0 ) ? 0 : (__eprintf ("%s:%u: failed assertion `%s'\n",	 "Fifo.cc",  82, "list != 0"), 0) )) ;
	    register Index i;
	    register Index moved;
	    for (i = listHead, moved = 0; moved < listElements;
		 i = advance(i)) {
		     if (pValid[i] != 0) {
			 p[moved] = list[i];
			 validP[moved] = 1;
			 moved++;
		     }
		 }
	    delete list;
	    delete pValid;
	}
	list = p;
	pValid = validP;
	listTail = listElements;
	listHead = 0;
	allocatedSize = howMuch;
    }
}
template <class Item>
void 
Fifo<Item>::add(Item t)
{
    if (advance(listTail) == listHead || listElements >= allocatedSize)  {
	if ( allocatedSize <= 0 ) {
	    resize(2);
	} else {
	    resize(((allocatedSize * 3) / 2) );
	}
    }
    list[listTail] = t;
    pValid[listTail] = 1;
    listTail = advance(listTail);
    listElements++;
}
template <class Item>
bool Fifo<Item>::remove(Item& item)
{
    bool ok = TRUE;
    if ((listElements > 0) && pValid[listHead]) {
	item = list[listHead];
	pValid[listHead] = 0;
	listHead = advance(listHead);
	listElements--;
    } else {
	char valid = 0;
	ok = TRUE;
	do {
	    if (listHead == listTail || list == 0) {
		ok = FALSE;
		break;
	    }
	    item = list[listHead];
	    valid = pValid[listHead];
	    pValid[listHead] = 0;  
	    listHead = advance(listHead);
	} while(valid == 0);
	if (ok) {
	    listElements--;
	}
    }
    return(ok);
}
template <class Item>
bool Fifo<Item>::removeIfFound(Item& item)
{
    bool ok = TRUE;
    if ((listElements > 0)
	&& pValid[listHead]
	&& list[listHead] == item) {
	    pValid[listHead]=0;
	    listHead = advance(listHead);
	    listElements--;
	} else {
	    if (listElements == 0 || list == 0) {
		ok = FALSE;
	    } else {
		bool valid = FALSE;
		if (pValid[listHead] && list[listHead] == item) {
		    valid = TRUE;
		    pValid[listHead] = 0;
		    listHead = advance(listHead);
		    listElements--;
		} else {
		    register Index i = listHead;
		    register Index examined = 0;
		    ok = FALSE;
		    while(examined < listElements) {
			if (pValid[i]) {
			    examined++;
			    if (list[i] == item) {
				ok = TRUE;
				pValid[i] = 0;
				listElements--;
				break;
			    }
			}
			i = advance(i);
		    }
		}
	    }
	}
    return(ok);
}
template <class Item>
bool
Fifo<Item>::empty()
{
    if ( size() == 0 ) {
	return (TRUE);
    } else {
	return (FALSE);
    }
}
template <class Item>
Index
Fifo<Item>::size()
{
    return(listElements);
}
# 2 "test.cc" 2
# 1 "/srl/Gcc2/lib/g++-include/stream.h" 1 3
# 1 "/srl/Gcc2/lib/g++-include/iostream.h" 1 3
#pragma interface
# 1 "/srl/Gcc2/lib/g++-include/streambuf.h" 1 3
#pragma interface
class ostream; class streambuf; class backupbuf;
extern "C" int __underflow(streambuf*);
extern "C" int __overflow(streambuf*, int);
typedef _G_off_t streamoff;
typedef _G_off_t streampos;  
typedef unsigned long __fmtflags;
typedef unsigned char __iostate;
struct _ios_fields {  
    streambuf *_strbuf;
    ostream* _tie;
    int _width;
    __fmtflags _flags;
    _G_wchar_t _fill;
    __iostate _state;
    __iostate _exceptions;
    int _precision;
};
enum state_value {
    _good = 0 ,
    _eof = 1 ,
    _fail = 2 ,
    _bad = 4  };
enum open_mode {
    input = 1 ,
    output = 2 ,
    atend = 4 ,
    append = 8  };
class ios : public _ios_fields {
  public:
    typedef __fmtflags fmtflags;
    typedef int iostate;
    typedef int openmode;
    enum io_state {
	goodbit = 0 ,
	eofbit = 1 ,
	failbit = 2 ,
	badbit = 4  };
    enum open_mode {
	in = 1 ,
	out = 2 ,
	ate = 4 ,
	app = 8 ,
	trunc = 16 ,
	nocreate = 32 ,
	noreplace = 64 ,
	bin = 128  };
    enum seek_dir { beg, cur, end};
    enum { skipws=01, left=02, right=04, internal=010,
	   dec=020, oct=040, hex=0100,
	   showbase=0200, showpoint=0400, uppercase=01000, showpos=02000,
	   scientific=04000, fixed=010000, unitbuf=020000, stdio=040000,
	   dont_close=0x80000000  
	   };
    enum {  
	basefield=dec+oct+hex,
	floatfield = scientific+fixed,
	adjustfield = left+right+internal
    };
# 138 "/srl/Gcc2/lib/g++-include/streambuf.h" 3
    ostream* tie() const { return _tie; }
    ostream* tie(ostream* val) { ostream* save=_tie; _tie=val; return save; }
    _G_wchar_t fill() const { return (_G_wchar_t)_fill; }
    _G_wchar_t fill(_G_wchar_t newf)
	{_G_wchar_t oldf = (_G_wchar_t)_fill; _fill = (char)newf; return oldf;}
    fmtflags flags() const { return _flags; }
    fmtflags flags(fmtflags new_val) {
	fmtflags old_val = _flags; _flags = new_val; return old_val; }
    int precision() const { return _precision; }
    int precision(int newp) {
	unsigned short oldp = _precision; _precision = (unsigned short)newp;
	return oldp; }
    fmtflags setf(fmtflags val) {
	fmtflags oldbits = _flags;
	_flags |= val; return oldbits; }
    fmtflags setf(fmtflags val, fmtflags mask) {
	fmtflags oldbits = _flags;
	_flags = (_flags & ~mask) | (val & mask); return oldbits; }
    fmtflags unsetf(fmtflags mask) {
	fmtflags oldbits = _flags & mask;
	_flags &= ~mask; return oldbits; }
    int width() const { return _width; }
    int width(int val) { int save = _width; _width = val; return save; }
    void _throw_failure() { }
    streambuf* rdbuf() const { return _strbuf; }
    void clear(iostate state = 0) {
	_state = _strbuf ? state : state|badbit;
	if (_state & _exceptions) _throw_failure(); }
    void set(iostate flag) { _state |= flag;
	if (_state & _exceptions) _throw_failure(); }
    int good() const { return _state == 0; }
    int eof() const { return _state & ios::eofbit; }
    int fail() const { return _state & (ios::badbit|ios::failbit); }
    int bad() const { return _state & ios::badbit; }
    iostate rdstate() const { return _state; }
    operator void*() const { return fail() ? (void*)0 : (void*)(-1); }
    int operator!() const { return fail(); }
    iostate exception(iostate enable) {
	iostate old = _exceptions; _exceptions = enable;
	if (_state & _exceptions) _throw_failure();
	return old; }
    static int sync_with_stdio(int on);
    static void sync_with_stdio() { sync_with_stdio(1); }
    void unset(state_value flag) { _state &= ~flag; }
    void close();
    int is_open();
    int readable();
    int writable();
  protected:
    ios(streambuf* sb = 0, ostream* tie = 0);
    virtual ~ios();
    void init(streambuf* sb) { _state=0; _strbuf=sb; }
};
typedef ios::seek_dir _seek_dir;
class streammarker {
    friend class streambuf;
    friend int __underflow(streambuf*);
    struct streammarker *_next;   
    streambuf *_sbuf;  
    streampos _spos;  
    void set_streampos(streampos sp) { _spos = sp; }
    void set_offset(int offset) { _pos = offset; _spos = (streampos)(-2); }
    int _pos;
  public:
    streammarker(streambuf *sb);
    ~streammarker();
    int saving() { return  _spos == -2; }
    int delta(streammarker&);
    int delta();
};
struct __streambuf {
    int _flags;		 
    char* _gptr;	 
    char* _egptr;	 
    char* _eback;	 
    char* _pbase;	 
    char* _pptr;	 
    char* _epptr;	 
    char* _base;	 
    char* _ebuf;	 
    struct streambuf *_chain;
    friend class streammarker;
    char *_other_gbase;  
    char *_aux_limit;   
    char *_other_egptr;  
    streammarker *_markers;
    unsigned short _cur_column;
    char _unused;
    char _shortbuf[1];
};
extern unsigned __adjust_column(unsigned start, const char *line, int count);
struct streambuf : private __streambuf {
    friend class ios;
    friend class istream;
    friend class ostream;
    friend class streammarker;
    friend int __underflow(streambuf*);
  protected:
    static streambuf* _list_all;  
    streambuf*& xchain() { return _chain; }
    void _un_link();
    void _link_in();
    char* gptr() const { return _gptr; }
    char* pptr() const { return _pptr; }
    char* egptr() const { return _egptr; }
    char* epptr() const { return _epptr; }
    char* pbase() const { return _pbase; }
    char* eback() const { return _eback; }
    char* base() const { return _base; }
    char* ebuf() const { return _ebuf; }
    int blen() const { return _ebuf - _base; }
    void xput_char(char c) { *_pptr++ = c; }
    int xflags() { return _flags; }
    int xflags(int f) { int fl = _flags; _flags = f; return fl; }
    void xsetflags(int f) { _flags |= f; }
    void xsetflags(int f, int mask) { _flags = (_flags & ~mask) | (f & mask); }
    void gbump(int n) { _gptr += n; }
    void pbump(int n) { _pptr += n; }
    void setb(char* b, char* eb, int a=0);
    void setp(char* p, char* ep) { _pbase=_pptr=p; _epptr=ep; }
    void setg(char* eb, char* g, char *eg) { _eback=eb; _gptr=g; _egptr=eg; }
    char *shortbuf() { return _shortbuf; }
    int in_backup() { return _flags & 0x100 ; }
    char *Gbase() { return in_backup() ? _other_gbase : _eback; }
    char *eGptr() { return in_backup() ? _other_egptr : _egptr; }
    char *Bbase() { return in_backup() ? _eback : _other_gbase; }
    char *Bptr() { return _aux_limit; }
    char *eBptr() { return in_backup() ? _egptr : _other_egptr; }
    char *Nbase() { return _other_gbase; }
    char *eNptr() { return _other_egptr; }
    int have_backup() { return _other_gbase != ((void *)0) ; }
    int have_markers() { return _markers != ((void *)0) ; }
    int _least_marker();
    void switch_to_main_get_area();
    void switch_to_backup_area();
    void free_backup_area();
    void unsave_markers();  
    int put_mode() { return _flags & 0x800 ; }
    int switch_to_get_mode();
    streambuf(int flags=0);
  public:
    static int flush_all();
    static void flush_all_linebuffered();  
    virtual int underflow() = 0;  
    virtual int overflow(int c = (-1) ) = 0;  
    virtual int doallocate();
    virtual streampos seekoff(streamoff, _seek_dir, int mode=ios::in|ios::out);
    virtual streampos seekpos(streampos pos, int mode = ios::in|ios::out);
    int seekmark(streammarker& mark, int delta = 0);
    int sputbackc(char c);
    int sungetc();
    virtual ~streambuf();
    int unbuffered() { return _flags & 2  ? 1 : 0; }
    int linebuffered() { return _flags & 0x200  ? 1 : 0; }
    void unbuffered(int i)
	{ if (i) _flags |= 2 ; else _flags &= ~2 ; }
    void linebuffered(int i)
	{ if (i) _flags |= 0x200 ; else _flags &= ~0x200 ; }
    int allocate() {  
	if (base() || unbuffered()) return 0;
	else return doallocate(); }
    void allocbuf() { if (base() == ((void *)0) ) doallocbuf(); }
    void doallocbuf();
    virtual int sync();
    virtual int pbackfail(int c);
    virtual streambuf* setbuf(char* p, int len);
    int in_avail() { return _egptr - _gptr; }
    int out_waiting() { return _pptr - _pbase; }
    virtual int xsputn(const char* s, int n);
    int sputn(const char* s, int n) { return xsputn(s, n); }
    int padn(char pad, int n);  
    virtual int xsgetn(char* s, int n);
    int sgetn(char* s, int n) { return xsgetn(s, n); }
    int ignore(int);
    virtual int get_column();
    virtual int set_column(int);
    long sgetline(char* buf, _G_size_t n, char delim, int putback_delim);
    int sbumpc() {
	if (_gptr >= _egptr && __underflow(this) == (-1) ) return (-1) ;
	else return *(unsigned char*)_gptr++; }
    int sgetc() {
	if (_gptr >= _egptr && __underflow(this) == (-1) ) return (-1) ;
	else return *(unsigned char*)_gptr; }
    int snextc() {
	if (_gptr >= _egptr && __underflow(this) == (-1) ) return (-1) ;
	return _gptr++, sgetc(); }
    int sputc(int c) {
	if (_pptr >= _epptr) return __overflow(this, (unsigned char)c);
	else return *_pptr++ = c, (unsigned char)c; }
    void stossc() { if (_gptr < _egptr) _gptr++; }
    int vscan(char const *fmt0, _G_va_list ap, ios* stream = ((void *)0) );
    int scan(char const *fmt0 ...);
    int vform(char const *fmt0, _G_va_list ap);
    int form(char const *fmt0 ...);
};
class backupbuf : public streambuf {
    friend class streammarker;
  protected:
    backupbuf(int flags=0) : streambuf(flags|0x4000 ) { }
  public:
    virtual int pbackfail(int c);
    virtual int underflow();
    virtual int overflow(int c = (-1) );
};
struct __file_fields {
    short _fileno;
    int _blksize;
    _G_fpos_t  _offset;
};
class filebuf : public backupbuf {
  protected:
    struct __file_fields _fb;
    void init();
  public:
    static const int openprot;  
    filebuf();
    filebuf(int fd);
    filebuf(int fd, char* p, int len);
    ~filebuf();
    filebuf* attach(int fd);
    filebuf* open(const char *filename, const char *mode);
    filebuf* open(const char *filename, ios::openmode mode, int prot = 0664);
    virtual int underflow();
    virtual int overflow(int c = (-1) );
    int is_open() const { return _fb._fileno >= 0; }
    int fd() const { return is_open() ? _fb._fileno : (-1) ; }
    filebuf* close();
    virtual int doallocate();
    virtual streampos seekoff(streamoff, _seek_dir, int mode=ios::in|ios::out);
    virtual streambuf* setbuf(char* p, int len);
    int xsputn(const char* s, int n);
    int xsgetn(char* s, int n);
    virtual int sync();
  protected:  
    int is_reading() { return eback() != egptr(); }
    char* cur_ptr() { return is_reading() ?  gptr() : pptr(); }
    char* file_ptr() { return eGptr(); }
    int do_write(const char *data, int to_do);
    int do_flush() { return do_write(_pbase, _pptr-_pbase); }
    virtual _G_ssize_t sys_read(char* buf, _G_size_t size);
    virtual _G_fpos_t  sys_seek(_G_fpos_t , _seek_dir);
    virtual _G_ssize_t sys_write(const void*, long);
    virtual int sys_stat(void*);  
    virtual int sys_close();
};
inline ios::ios(streambuf* sb  , ostream* tie  ) {
		_state = sb ? ios::goodbit : ios::badbit; _exceptions=0;
		_strbuf=sb; _tie = tie; _width=0; _fill=' ';
		_flags=ios::skipws|ios::dec; _precision=6; }
inline ios::~ios() {
    if (!(_flags & (unsigned int)ios::dont_close)) delete _strbuf; }
# 24 "/srl/Gcc2/lib/g++-include/iostream.h" 2 3
class istream; class ostream;
typedef ios& (*__manip)(ios&);
typedef istream& (*__imanip)(istream&);
typedef ostream& (*__omanip)(ostream&);
extern istream& ws(istream& ins);
extern ostream& flush(ostream& outs);
extern ostream& endl(ostream& outs);
extern ostream& ends(ostream& outs);
class ostream : virtual public ios
{
    void do_osfx();
  public:
    ostream() { }
    ostream(streambuf* sb, ostream* tied=((void *)0) );
    int opfx() {
	if (!good()) return 0; else { if (_tie) _tie->flush(); return 1;} }
    void osfx() { if (flags() & (ios::unitbuf|ios::stdio))
		      do_osfx(); }
    streambuf* ostreambuf() const { return _strbuf; }
    ostream& flush();
    ostream& put(char c) { _strbuf->sputc(c); return *this; }
    ostream& put(unsigned char c) { return put((char)c); }
    ostream& write(const char *s, int n);
    ostream& write(const unsigned char *s, int n) { return write((const char*)s, n);}
    ostream& write(const void *s, int n) { return write((const char*)s, n);}
    ostream& seekp(streampos);
    ostream& seekp(streamoff, _seek_dir);
    streampos tellp();
    ostream& form(const char *format ...);
    ostream& vform(const char *format, _G_va_list args);
    ostream& operator<<(char c);
    ostream& operator<<(unsigned char c) { return (*this) << (char)c; }
    ostream& operator<<(const char *s);
    ostream& operator<<(const unsigned char *s)
	{ return (*this) << (const char*)s; }
    ostream& operator<<(void *p);
    ostream& operator<<(int n);
    ostream& operator<<(unsigned int n);
    ostream& operator<<(long n);
    ostream& operator<<(unsigned long n);
    ostream& operator<<(long long n);
    ostream& operator<<(unsigned long long n);
    ostream& operator<<(short n) {return operator<<((int)n);}
    ostream& operator<<(unsigned short n) {return operator<<((unsigned int)n);}
    ostream& operator<<(double n);
    ostream& operator<<(float n) { return operator<<((double)n); }
    ostream& operator<<(__omanip func) { return (*func)(*this); }
    ostream& operator<<(__manip func) {(*func)(*this); return *this;}
    ostream& operator<<(streambuf*);
};
class istream : virtual public ios
{
    _G_ssize_t _gcount;
    int _skip_ws();
  public:
    istream() { _gcount = 0; }
    istream(streambuf* sb, ostream*tied=((void *)0) );
    streambuf* istreambuf() const { return _strbuf; }
    istream& get(char* ptr, int len, char delim = '\n');
    istream& get(unsigned char* ptr, int len, char delim = '\n')
	{ return get((char*)ptr, len, delim); }
    istream& get(char& c);
    istream& get(unsigned char& c) { return get((char&)c); }
    istream& getline(char* ptr, int len, char delim = '\n');
    istream& getline(unsigned char* ptr, int len, char delim = '\n')
	{ return getline((char*)ptr, len, delim); }
    istream& read(char *ptr, int n);
    istream& read(unsigned char *ptr, int n) { return read((char*)ptr, n); }
    istream& read(void *ptr, int n) { return read((char*)ptr, n); }
    istream& get(streambuf& sb, char delim = '\n');
    istream& gets(char **s, char delim = '\n');
    int ipfx(int need) {
	if (!good()) { set(ios::failbit); return 0; }
	if (_tie && (need == 0 || rdbuf()->in_avail() < need)) _tie->flush();
	if (!need && (flags() & ios::skipws)) return _skip_ws();
	return 1;
    }
    int ipfx0() {  
	if (!good()) { set(ios::failbit); return 0; }
	if (_tie) _tie->flush();
	if (flags() & ios::skipws) return _skip_ws();
	return 1;
    }
    int ipfx1() {  
	if (!good()) { set(ios::failbit); return 0; }
	if (_tie && rdbuf()->in_avail() == 0) _tie->flush();
	return 1;
    }
    int get() { if (!ipfx1()) return (-1) ;
		int ch = _strbuf->sbumpc();
		if (ch == (-1) ) set(ios::eofbit);
		return ch; }
    int peek() { if (!ipfx1()) return (-1) ;
		int ch = _strbuf->sgetc();
		if (ch == (-1) ) set(ios::eofbit);
		return ch; }
    _G_ssize_t gcount() { return _gcount; }
    istream& ignore(int n=1, int delim = (-1) );
    istream& seekg(streampos);
    istream& seekg(streamoff, _seek_dir);
    streampos tellg();
    istream& putback(char ch) {
	if (good() && _strbuf->sputbackc(ch) == (-1) ) clear(ios::badbit);
	return *this;}
    istream& unget() {
	if (good() && _strbuf->sungetc() == (-1) ) clear(ios::badbit);
	return *this;}
    istream& scan(const char *format ...);
    istream& vscan(const char *format, _G_va_list args);
    istream& unget(char ch) { return putback(ch); }
    int skip(int i);
    istream& operator>>(char*);
    istream& operator>>(unsigned char* p) { return operator>>((char*)p); }
    istream& operator>>(char& c);
    istream& operator>>(unsigned char& c) {return operator>>((char&)c);}
    istream& operator>>(int&);
    istream& operator>>(long&);
    istream& operator>>(long long&);
    istream& operator>>(short&);
    istream& operator>>(unsigned int&);
    istream& operator>>(unsigned long&);
    istream& operator>>(unsigned long long&);
    istream& operator>>(unsigned short&);
    istream& operator>>(float&);
    istream& operator>>(double&);
    istream& operator>>( __manip func) {(*func)(*this); return *this;}
    istream& operator>>(__imanip func) { return (*func)(*this); }
    istream& operator>>(streambuf*);
};
class iostream : public istream, public ostream
{
    _G_ssize_t _gcount;
  public:
    iostream() { _gcount = 0; }
    iostream(streambuf* sb, ostream*tied=((void *)0) );
};
extern istream cin;
extern ostream cout, cerr, clog;  
struct Iostream_init { } ;   
inline ios& dec(ios& i)
{ i.setf(ios::dec, ios::dec|ios::hex|ios::oct); return i; }
inline ios& hex(ios& i)
{ i.setf(ios::hex, ios::dec|ios::hex|ios::oct); return i; }
inline ios& oct(ios& i)
{ i.setf(ios::oct, ios::dec|ios::hex|ios::oct); return i; }
# 7 "/srl/Gcc2/lib/g++-include/stream.h" 2 3
extern char* form(const char*, ...);
extern char* dec(long, int=0);
extern char* dec(int, int=0);
extern char* dec(unsigned long, int=0);
extern char* dec(unsigned int, int=0);
extern char* hex(long, int=0);
extern char* hex(int, int=0);
extern char* hex(unsigned long, int=0);
extern char* hex(unsigned int, int=0);
extern char* oct(long, int=0);
extern char* oct(int, int=0);
extern char* oct(unsigned long, int=0);
extern char* oct(unsigned int, int=0);
inline istream& WS(istream& str) { return ws(str); }
# 3 "test.cc" 2
Fifo<int> p;
main()
{
    Fifo<int> q;
    for (int i = 0; i < 20; i++ ) {
	cout << "add " << i << "\n";
	q.add(i);
    }
    while (! q.empty() ) {
	if (q.remove(i) ) {
	    cout << "get " << i << "\n";
	} else {
	    cout << "no removal\n";
	}
    }
}

Newsgroups: gnu.g++.bug