summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/warn/Wunused-var-8.C
blob: 69fc6fb7918c13d17de1cb929961e38c32ebe069 (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
43
44
45
46
// { dg-do compile }
// { dg-options "-Wunused" }

template <int N>
void
f1 (void)
{
  extern int extvari;
  extvari = 1;
}

int extvarj;

template <int N>
void
f2 (void)
{
  extern int extvarj;
  extvarj = 1;
}

static int extvark;

template <int N>
void
f3 (void)
{
  extern int extvark;
  extvark = 1;
}

template <int N>
int
f4 (void)
{
  return extvark;
}

void
test ()
{
  f1<0> ();
  f2<0> ();
  f3<0> ();
  (void) f4<0> ();
}