summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.brendan/nest21.C
diff options
context:
space:
mode:
authorupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
committerupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
commit554fd8c5195424bdbcabf5de30fdc183aba391bd (patch)
tree976dc5ab7fddf506dadce60ae936f43f58787092 /gcc/testsuite/g++.old-deja/g++.brendan/nest21.C
downloadcbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.bz2
cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.xz
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository.
Diffstat (limited to 'gcc/testsuite/g++.old-deja/g++.brendan/nest21.C')
-rw-r--r--gcc/testsuite/g++.old-deja/g++.brendan/nest21.C97
1 files changed, 97 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/nest21.C b/gcc/testsuite/g++.old-deja/g++.brendan/nest21.C
new file mode 100644
index 000000000..62ddab156
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.brendan/nest21.C
@@ -0,0 +1,97 @@
+// { dg-do run }
+// GROUPS passed nested-classes
+#include <iostream>
+#include <cstdio>
+#include <cstring>
+
+static char output[1024];
+
+class BDDRetrace {
+public:
+ class Dump {
+ public:
+ virtual Dump& operator<<(char c) = 0;
+ virtual Dump& operator<<(int i) = 0;
+ virtual Dump& operator<<(double r) = 0;
+ };
+
+ class Dump1: public Dump {
+ public:
+ Dump& operator<<(char c);
+ Dump& operator<<(int i);
+ Dump& operator<<(double r);
+ };
+};
+
+class Dump2: public BDDRetrace::Dump {
+public:
+ BDDRetrace::Dump& operator<<(char c);
+ BDDRetrace::Dump& operator<<(int i);
+ BDDRetrace::Dump& operator<<(double r);
+};
+
+BDDRetrace::Dump&
+BDDRetrace::Dump1::operator<<(char c)
+{ char tempout[1024];
+ std::sprintf(tempout, "%s%s%c", output, "1-", c);
+ std::strcpy(output, tempout);
+ return *this;
+}
+
+BDDRetrace::Dump&
+BDDRetrace::Dump1::operator<<(int i)
+{ char tempout[1024];
+ std::sprintf (tempout, "%s%s%d", output, "1-", i);
+ std::strcpy (output, tempout);
+ return *this; }
+
+BDDRetrace::Dump&
+BDDRetrace::Dump1::operator<<(double r)
+{ char tempout[1024];
+ std::sprintf (tempout, "%s%s%1.0f", output, "1-", r);
+ std::strcpy (output, tempout);
+ return *this; }
+
+BDDRetrace::Dump&
+Dump2::operator<<(char c)
+{ char tempout[1024];
+ std::sprintf (tempout, "%s%s%c", output, "2-", c);
+ std::strcpy (output, tempout);
+ return *this; }
+
+BDDRetrace::Dump&
+Dump2::operator<<(int i)
+{ char tempout[1024];
+ std::sprintf (tempout, "%s%s%d", output, "2-", i);
+ std::strcpy (output, tempout);
+ return *this; }
+
+BDDRetrace::Dump&
+Dump2::operator<<(double r)
+{ char tempout[1024];
+ std::sprintf (tempout, "%s%s%1.0f", output, "2-", r);
+ std::strcpy (output, tempout);
+ return *this; }
+
+int main()
+{
+ BDDRetrace::Dump1 d1;
+ Dump2 d2;
+
+ std::sprintf (output, " ");
+
+ d1 << 'a';
+ d1 << 1;
+ d1 << 1.0;
+
+ d2 << 'a';
+ d2 << 1;
+ d2 << 1.0;
+
+ if (std::strcmp (output, " 1-a1-11-12-a2-12-1") == 0)
+ std::printf ("PASS\n");
+ else
+ { std::printf ("FAIL\n"); return 1; }
+
+ return 0;
+}