summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/compat/init/init-ref2_x.C
blob: 7fbec89b645ed0845aa99bc5e0590f3b4bf7e92d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
extern "C" void abort (void);
extern void g (void);
extern void h (void);

int r;
int c;
int f ()
{
  // Test that we only initialize i once.
  if (++c > 1)
    ++r;
  return 42;
}

void
init_ref2_x (void)
{
  g ();
  h ();
  if (r != 0)
    abort ();
}