summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/warn/Wunused-var-10.C
blob: ffdb893279070203ac1598d6d927c0324112f480 (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
34
35
36
37
38
39
40
41
42
// PR c++/44412
// { dg-do compile }
// { dg-options "-Wunused" }

struct S
{
  static const int a = 3;
  static int b;
  int c;
};

const int S::a;
int S::b = 4;

int
f1 ()
{
  S s;
  return s.a;
}

int
f2 ()
{
  S s;
  return s.b;
}

void
f3 ()
{
  S s;		// { dg-warning "set but not used" }
  s.c = 6;
}

int
f4 ()
{
  S s;
  s.c = 6;
  return s.c;
}