summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.law/virtual3.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.old-deja/g++.law/virtual3.C')
-rw-r--r--gcc/testsuite/g++.old-deja/g++.law/virtual3.C49
1 files changed, 49 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.old-deja/g++.law/virtual3.C b/gcc/testsuite/g++.old-deja/g++.law/virtual3.C
new file mode 100644
index 000000000..46fa08512
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.law/virtual3.C
@@ -0,0 +1,49 @@
+// { dg-do run }
+// 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>
+#include <sstream>
+
+using namespace std;
+
+class BugStream : public ostringstream {
+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
+ const char* s = str().data();
+ cerr << s << endl;
+
+ // reset the stream for the next command
+ clear(ios::goodbit);
+ // rdbuf()->freeze(0);
+ seekp(0);
+
+ return *this;
+}
+
+BugStream& operator<<(ostream& os, Eval_)
+{
+ return ((BugStream&)os).eval();
+}
+
+int main() {
+ BugStream bs;
+ bs << "PASS" << eval;
+}