aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/Wunused-var-4.c
blob: 08ddcf4407e48a8f833a3f9a96a3bcde5c216f78 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/* PR c/96571 */
/* { dg-do compile } */
/* { dg-options "-std=c99 -O2 -Wunused-but-set-variable" } */

enum E { V };

int
foo (void)
{
  enum E v;				/* { dg-bogus "set but not used" } */
  return _Generic (v, enum E : 0);
}

int
bar (void)
{
  int a = 0;				/* { dg-bogus "set but not used" } */
  return _Generic (0, int : a);
}

int
baz (void)
{
  int a;				/* { dg-bogus "set but not used" } */
  return _Generic (0, long long : a, int : 0);
}

int
qux (void)
{
  int a;				/* { dg-bogus "set but not used" } */
  return _Generic (0, long long : a, default: 0);
}