Debian Codegraph @

gcc/testsuite/g++.old-deja/g++.other/ptrmem9.C

raw
1 // { dg-do run }
2 // Test that const-correctness is observed when using pointers-to-members.
3
4 struct A {
5 int f () { return 1; }
6 int f () const { return 0; }
7 };
8
9 struct B {
10 A a;
11 B() { }
12 };
13
14 int main ()
15 {
16 A B::*bm = &B::a;
17 const B b;
18 return (b.*bm).f ();
19 }