aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/c23-if-decls-1.c
blob: ea968c67c6a0cd48db98a922eb8ab704fbb8e9d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/* N3356 - if declarations.  */
/* PR c/117019 */
/* { dg-do compile } */
/* { dg-options "-std=c23 -pedantic-errors" } */

void
g ()
{
  if (int i = 42);		/* { dg-error "ISO C does not support if declarations before C2Y" } */
  if (int i = 42; i > 10);	/* { dg-error "ISO C does not support if declarations before C2Y" } */
  if (int i, j; i = 42);	/* { dg-error "ISO C does not support if declarations before C2Y" } */
  switch (int i = 42);		/* { dg-error "ISO C does not support if declarations before C2Y" } */
  switch (int i = 42; i);	/* { dg-error "ISO C does not support if declarations before C2Y" } */
  switch (int i, j; i = 42);	/* { dg-error "ISO C does not support if declarations before C2Y" } */
}