diff options
Diffstat (limited to 'gcc/testsuite/gcc.dg/cpp/if-sc.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/cpp/if-sc.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/cpp/if-sc.c b/gcc/testsuite/gcc.dg/cpp/if-sc.c new file mode 100644 index 000000000..1607669f0 --- /dev/null +++ b/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 |