* g++.dg/opt/cond1.C: New test.
authorJakub Jelinek <jakub@redhat.com>
Thu, 2 Oct 2003 12:11:45 +0000 (14:11 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Thu, 2 Oct 2003 12:11:45 +0000 (14:11 +0200)
From-SVN: r72022

gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/opt/cond1.C [new file with mode: 0644]

index 69a716e..285b52e 100644 (file)
@@ -1,3 +1,7 @@
+2003-10-02  Jakub Jelinek  <jakub@redhat.com>
+
+       * g++.dg/opt/cond1.C: New test.
+
 2003-10-01  Kelley Cook  <kelleycook@wideopenwest.com>
 
        * gcc.dg/Wold-style-definition-2.c: New testcase.
diff --git a/gcc/testsuite/g++.dg/opt/cond1.C b/gcc/testsuite/g++.dg/opt/cond1.C
new file mode 100644 (file)
index 0000000..ae8fa4d
--- /dev/null
@@ -0,0 +1,24 @@
+// { dg-do run }
+// { dg-options "-O2" }
+
+struct D { int x; };
+struct W
+{
+  W () {}
+  D & operator * () { return d; }
+  D d;
+};
+
+int
+foo (int y)
+{
+  W m;
+  (*m).x = (y > 1 ? y : 0);
+  return (*m).x;
+}
+
+int
+main ()
+{
+  return (foo (6) != 6);
+}