aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/expr/pmf-4.C
blob: 87c9be18f70d8ab6f59b7311df16f69eaf0d6fa8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// PR c++/118509
// { dg-do run }
// { dg-options "-Wall -O2" }

struct A { void foo () { a = 1; } int a; A () : a (0) {} };
struct B : virtual A {};
typedef void (A::*C) ();

__attribute__((noipa)) void
foo (C x, B *y)
{
  (y->*x) ();
}

int
main ()
{
  B b;
  foo (&A::foo, &b);
  if (b.a != 1)
    __builtin_abort ();
}