summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/opt/pr19317-2.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.dg/opt/pr19317-2.C')
-rw-r--r--gcc/testsuite/g++.dg/opt/pr19317-2.C32
1 files changed, 32 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/opt/pr19317-2.C b/gcc/testsuite/g++.dg/opt/pr19317-2.C
new file mode 100644
index 000000000..70c642b21
--- /dev/null
+++ b/gcc/testsuite/g++.dg/opt/pr19317-2.C
@@ -0,0 +1,32 @@
+// PR c++/19317
+// { dg-options "-O2" }
+// { dg-do run }
+
+extern "C" void abort (void);
+
+struct A
+{
+ A () { d = e = 0; f = -1; }
+ A (int x) : d (0), e (0), f (x) { }
+ A b () const;
+ int d;
+ int e;
+ int f;
+};
+
+A
+A::b () const
+{
+ A t;
+ t.f = 10 + this->f;
+ return t;
+}
+
+int
+main ()
+{
+ A a (100);
+ a = a.b ();
+ if (a.f != 110)
+ abort ();
+}