summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/expr/pr29066.C
blob: 8bf6bb0a0c8ca9c5f5002d77726bb7340672d982 (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++/29066
// Test pointer to member function comparison
// { dg-do run }

extern "C" void abort (void);

struct X
{
  virtual void a(void)=0;
};

struct Z : public X
{
  void a(void) {}
};


void f(X *obj)
{
  void (X::*xp)(void) = 0;
  void (X::*xp2)(void) = 0;

  xp = &X::a;

  if (xp == xp2)
    {
      abort(); 
    } 

  if (xp == 0)
    {
      abort();
    }
}

int main(int argc, char* argv[])
{
  Z myobj;

  f(&myobj);
  return 0;
}