diff options
Diffstat (limited to 'gcc/testsuite/gcc.dg/gnu-cond-expr-3.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/gnu-cond-expr-3.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/gnu-cond-expr-3.c b/gcc/testsuite/gcc.dg/gnu-cond-expr-3.c new file mode 100644 index 00000000000..e15ed0259c7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/gnu-cond-expr-3.c @@ -0,0 +1,13 @@ +/* Test diagnostic for GNU extension: omitting middle term of + conditional expression. Test with -pedantic-errors. */ +/* Origin: Joseph Myers <joseph@codesourcery.com> */ +/* { dg-do compile } */ +/* { dg-options "-std=gnu99 -pedantic-errors" } */ + +int a, b, c; + +void +f (void) +{ + c = (++a ? : b); /* { dg-error "error: ISO C forbids omitting the middle term of a \\?: expression" } */ +} |