8sa1-gcc/gcc/testsuite/g++.old-deja/g++.law/virtual3.C
Jeff Law 921e5a0eb4 Initial revision
From-SVN: r14840
1997-08-19 01:34:40 -06:00

48 lines
886 B
C

// GROUPS passed virtual-functions
// virtual file
// From: allan@ramjet.multinet.DE (Allan Brighton)
// Subject: pos. bug in gcc-2.5.2 on hp
// Date: 4 Nov 1993 22:57:36 -0500
// Message-ID: <9311041820.AA05942@ramjet.multinet.DE>
#include <iostream.h>
#include <strstream.h>
class BugStream : public ostrstream {
public:
BugStream() {}
BugStream& eval();
};
static struct Eval_ { } eval;
BugStream& operator<<(ostream& os, Eval_);
BugStream& BugStream::eval()
{
// make sure str is null terminated
*this << ends;
// eval the command and set the status
char* s = str();
cerr << s << endl;
// reset the stream for the next command
clear(0);
rdbuf()->freeze(0);
seekp(0);
return *this;
}
BugStream& operator<<(ostream& os, Eval_)
{
return ((BugStream&)os).eval();
}
main() {
BugStream bs;
bs << "PASS" << eval;
}