summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/gnu-cond-expr-2.c
blob: 53234dc26ca27ad427ceb0ed1c35ec78f4a410d8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
/* Test diagnostic for GNU extension: omitting middle term of
   conditional expression.  Test with -pedantic.  */
/* Origin: Joseph Myers <joseph@codesourcery.com> */
/* { dg-do compile } */
/* { dg-options "-std=gnu99 -pedantic" } */

int a, b, c;

void
f (void)
{
  c = (++a ? : b); /* { dg-warning "warning: ISO C forbids omitting the middle term of a \\?: expression" } */
}