summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.oliva/expr2.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.old-deja/g++.oliva/expr2.C')
-rw-r--r--gcc/testsuite/g++.old-deja/g++.oliva/expr2.C16
1 files changed, 16 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.old-deja/g++.oliva/expr2.C b/gcc/testsuite/g++.old-deja/g++.oliva/expr2.C
new file mode 100644
index 000000000..1e63c645b
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.oliva/expr2.C
@@ -0,0 +1,16 @@
+// { dg-do run }
+
+// Copyright (C) 2000 Free Software Foundation
+
+// by Alexandre Oliva <aoliva@cygnus.com>
+
+int i, j;
+
+const int &f(const int& I, const int& J) {
+ // this must not be optimized to I because it's an lvalue
+ return (I != J) ? I : J;
+}
+
+int main () {
+ return (&f(i, j) != &j);
+}