summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.other/cond6.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.old-deja/g++.other/cond6.C')
-rw-r--r--gcc/testsuite/g++.old-deja/g++.other/cond6.C15
1 files changed, 15 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.old-deja/g++.other/cond6.C b/gcc/testsuite/g++.old-deja/g++.other/cond6.C
new file mode 100644
index 000000000..db018a4a3
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.other/cond6.C
@@ -0,0 +1,15 @@
+// { dg-do assemble }
+// Test that the result of `x ? const E : E' is an E rvalue.
+// Contributed by Jason Merrill <jason@cygnus.com>
+
+enum E { a };
+
+bool b;
+
+int main ()
+{
+ E e1 = a;
+ const E &er = e1;
+ E e2 = b ? er : a; // OK
+ const E* ep = &(b ? er : a); // { dg-error "" } non-lvalue
+}