diff options
Diffstat (limited to 'gcc/testsuite/g++.old-deja/g++.other/ptrmem9.C')
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.other/ptrmem9.C | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.old-deja/g++.other/ptrmem9.C b/gcc/testsuite/g++.old-deja/g++.other/ptrmem9.C new file mode 100644 index 000000000..67d4f280e --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/ptrmem9.C @@ -0,0 +1,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 (); +} |