aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.dg/cpp/if-sc.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/testsuite/gcc.dg/cpp/if-sc.c')
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/cpp/if-sc.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/cpp/if-sc.c b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/if-sc.c
new file mode 100644
index 000000000..1607669f0
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/cpp/if-sc.c
@@ -0,0 +1,26 @@
+/* Copyright (C) 2000 Free Software Foundation, Inc. */
+
+/* { dg-do preprocess } */
+
+/* Test that all operators correctly short circuit. */
+
+#if (2 || 3 / 0) != 1
+#error /* { dg-bogus "error" "|| short circuit" } */
+#endif
+
+#if 0 && 3 / 0
+#error /* { dg-bogus "error" "&& short circuit" } */
+#endif
+
+#if 1 ? 0 : 3 / 0
+#error /* { dg-bogus "error" "? : right short circuit" } */
+#endif
+
+#if 0 ? 3 / 0 : 2
+#else
+#error /* { dg-bogus "error" "? : left short circuit" } */
+#endif
+
+#if -1 ? 0 && 3 / 0 : 3 / 0 + 5 == 5
+#error /* { dg-bogus "error" "nested short circuiting" } */
+#endif