aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.dg/cpp/if-cexp.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/testsuite/gcc.dg/cpp/if-cexp.c')
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/cpp/if-cexp.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/cpp/if-cexp.c b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/if-cexp.c
new file mode 100644
index 000000000..1ebd11929
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/if-cexp.c
@@ -0,0 +1,14 @@
+/* { dg-do preprocess } */
+
+/* Test the ? : opearator, for precedence and both true and false. */
+
+#if 1 ? 1 ? 2 : 0 : 0
+#error OK /* { dg-error "OK" "nested ? :" } */
+#endif
+
+#if ((0) ? (1) ? (2) : (3) : (4) ? (5): (6)) == 5
+#error OK /* { dg-error "OK" "nested ? : with parens" } */
+#endif
+
+#if 2: /* { dg-error "':' without" "immediate :" } */
+#endif