Merge from mainline (167278:168000).
[official-gcc/graphite-test-results.git] / gcc / testsuite / g++.old-deja / g++.law / virtual3.C
blob46fa08512be6fc4bfa326ec30e67567a74cf64ff
1 // { dg-do run  }
2 // GROUPS passed virtual-functions
3 // virtual file
4 // From: allan@ramjet.multinet.DE (Allan Brighton)
5 // Subject: pos. bug in gcc-2.5.2 on hp
6 // Date: 4 Nov 1993 22:57:36 -0500
7 // Message-ID: <9311041820.AA05942@ramjet.multinet.DE>
9 #include <iostream>
10 #include <sstream>
12 using namespace std;
14 class BugStream : public ostringstream {
15 public:
16     BugStream() {}
17     BugStream& eval();
21 static struct Eval_ { } eval;
22 BugStream& operator<<(ostream& os, Eval_);
24 BugStream& BugStream::eval()
26    // make sure str is null terminated
27    *this << ends;
28    
29    // eval the command and set the status
30    const char* s = str().data();
31    cerr << s << endl;
32    
33    // reset the stream for the next command    
34    clear(ios::goodbit);
35    //   rdbuf()->freeze(0);
36    seekp(0);
37    
38    return *this;
41 BugStream& operator<<(ostream& os, Eval_)
43     return ((BugStream&)os).eval();
46 int main() {
47     BugStream bs;
48     bs << "PASS" << eval;