summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.other/loop2.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.old-deja/g++.other/loop2.C')
-rw-r--r--gcc/testsuite/g++.old-deja/g++.other/loop2.C31
1 files changed, 31 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.old-deja/g++.other/loop2.C b/gcc/testsuite/g++.old-deja/g++.other/loop2.C
new file mode 100644
index 000000000..a9aa4a368
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.other/loop2.C
@@ -0,0 +1,31 @@
+// { dg-do assemble }
+// { dg-options "-O" }
+
+class foo {
+public:
+ operator const char*() const { return a; }
+ char *a;
+};
+
+class bar {
+public:
+ ~bar();
+ void operator++(int);
+ bool b() const;
+protected:
+ void* c() const;
+};
+
+class baz : public bar {
+public:
+ foo const &d() const { return *(foo *)bar::c(); }
+};
+
+extern int tst (const char *, const char *) throw();
+
+void die(const foo& x)
+{
+ for (baz hi; hi.b(); hi++)
+ if (tst (hi.d(), x) == 0)
+ return;
+}