aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/opt/pr61456.C
blob: 14a118b5720e1639f6a3bbbebe35a1d64e94b9c6 (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
// { dg-do compile }
// { dg-options "-O2 -std=c++11 -Werror=uninitialized" }

int rand ();

class Funcs
{
public:
    int *f1 ();
    int *f2 ();
};
typedef decltype (&Funcs::f1) pfunc;

static int Set (Funcs * f, const pfunc & fp)
{
  (f->*fp) ();
}

void
Foo ()
{
  pfunc fp = &Funcs::f1;
  if (rand ())
    fp = &Funcs::f2;
  Set (0, fp);
}