aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.8.1/gcc/testsuite/g++.dg/opt/pr19317-1.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.8.1/gcc/testsuite/g++.dg/opt/pr19317-1.C')
-rw-r--r--gcc-4.8.1/gcc/testsuite/g++.dg/opt/pr19317-1.C39
1 files changed, 39 insertions, 0 deletions
diff --git a/gcc-4.8.1/gcc/testsuite/g++.dg/opt/pr19317-1.C b/gcc-4.8.1/gcc/testsuite/g++.dg/opt/pr19317-1.C
new file mode 100644
index 000000000..ffb646a90
--- /dev/null
+++ b/gcc-4.8.1/gcc/testsuite/g++.dg/opt/pr19317-1.C
@@ -0,0 +1,39 @@
+// PR c++/19317
+// { dg-options "-O2" }
+// { dg-do run }
+// Origin: Dirk Mueller <mueller@kde.org>
+
+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 A &r) const;
+ int d;
+ int e;
+ int f;
+};
+
+A
+A::b (const A & r) const
+{
+ A t;
+ t.f = f < r.f ? f : r.f;
+ return t;
+}
+
+int
+main ()
+{
+ A a (100);
+ a = a.b (A (10));
+ if (a.f != 10)
+ abort ();
+
+ A c (10);
+ A d (100);
+ c = d.b (c);
+ if (c.f != 10)
+ abort ();
+}