aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/c2x-labels-2.c
blob: bd010e9ecfb9593166e735aeb7ea2d7aec88c912 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/* Tests for labels before declarations and at ends of compound statements.  */
/* { dg-do compile } */
/* { dg-options "-std=c2x -Wc11-c2x-compat" } */

int f(int x) 
{ 
	goto b;
	a: int i = 2 * x;	/* { dg-warning "a label can only be part of a statement and a declaration is not a statement" } */
           goto c;
	b: goto a;
	{ i *= 3; c: }		/* { dg-warning "label at end of compound statement" } */
	return i;
        d:			/* { dg-warning "label at end of compound statement" } */
}