aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.old-deja/g++.other/store-expr2.C
diff options
context:
space:
mode:
authorBen Cheng <bccheng@google.com>2014-03-25 22:37:19 -0700
committerBen Cheng <bccheng@google.com>2014-03-25 22:37:19 -0700
commit1bc5aee63eb72b341f506ad058502cd0361f0d10 (patch)
treec607e8252f3405424ff15bc2d00aa38dadbb2518 /gcc-4.9/gcc/testsuite/g++.old-deja/g++.other/store-expr2.C
parent283a0bf58fcf333c58a2a92c3ebbc41fb9eb1fdb (diff)
downloadtoolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.tar.gz
toolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.tar.bz2
toolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.zip
Initial checkin of GCC 4.9.0 from trunk (r208799).
Change-Id: I48a3c08bb98542aa215912a75f03c0890e497dba
Diffstat (limited to 'gcc-4.9/gcc/testsuite/g++.old-deja/g++.other/store-expr2.C')
-rw-r--r--gcc-4.9/gcc/testsuite/g++.old-deja/g++.other/store-expr2.C88
1 files changed, 88 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/g++.old-deja/g++.other/store-expr2.C b/gcc-4.9/gcc/testsuite/g++.old-deja/g++.other/store-expr2.C
new file mode 100644
index 000000000..1dffbcc1a
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.old-deja/g++.other/store-expr2.C
@@ -0,0 +1,88 @@
+// { dg-do run { target i?86-*-* x86_64-*-*} }
+// { dg-require-effective-target ilp32 }
+// { dg-options "-mtune=generic -O2" }
+class G {};
+
+struct N {
+ N *a;
+};
+
+struct V {
+ typedef N *W;
+ W *m, *n;
+ int s() const { return int(n - m); }
+ const W &operator[](int x) const { return *(m + x); }
+};
+
+struct H;
+
+struct J {
+ N *c;
+ H *d;
+ J(N *x, H *y) : c(x), d(y) {}
+};
+
+struct K {
+ const N *c;
+ const H *d;
+ K(const N *x, const H *y) : c(x), d(y) {}
+ K(const J &x) : c(x.c), d(x.d) {}
+};
+
+struct H {
+ V e;
+ int f;
+
+ J u()
+ {
+ for (int x = 0; x < e.s(); ++x)
+ if (e[x])
+ return J(e[x], this);
+ return v();
+ }
+ J v() { return J((N*)64, this); }
+};
+
+struct I {
+ H d;
+ J u() { return d.u(); }
+ J v() { return d.v(); }
+};
+
+struct bar {
+ virtual ~bar() {}
+};
+
+struct E {
+ K g;
+ E(K x) : g(x) {}
+};
+
+struct foo : public bar {
+ K h;
+ E i;
+ foo(const K x, const E &y) : h(x), i(y) {}
+};
+
+struct A {
+ I *l;
+ foo *baz() const;
+};
+
+foo *A::baz() const
+{
+ return new foo(l->u(), E(l->v()));
+}
+
+A x;
+I i;
+foo *f;
+
+int main ()
+{
+ x.l = &i;
+ f = x.baz();
+ if (f->h.c != f->i.g.c || f->h.d != f->i.g.d)
+ return 1;
+ return 0;
+}