summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.other/ptrmem9.C
blob: 67d4f280eedeaa67d9700cef428f6a56e6720821 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// { dg-do run  }
// Test that const-correctness is observed when using pointers-to-members.

struct A {
  int f () { return 1; }
  int f () const { return 0; }
};

struct B {
  A a;
  B() { }
};

int main ()
{
  A B::*bm = &B::a;
  const B b;
  return (b.*bm).f ();
}