Index: gdb/testsuite/gdb.cp/member-ptr.cc |
diff --git a/gdb/testsuite/gdb.cp/member-ptr.cc b/gdb/testsuite/gdb.cp/member-ptr.cc |
index 17f022cca6af6585de3896c27215794d10570d6b..4a34231b22cdecb78057d729ed3ef89e84adb704 100644 |
--- a/gdb/testsuite/gdb.cp/member-ptr.cc |
+++ b/gdb/testsuite/gdb.cp/member-ptr.cc |
@@ -1,6 +1,6 @@ |
/* This testcase is part of GDB, the GNU debugger. |
- Copyright 1998-1999, 2004, 2006-2012 Free Software Foundation, Inc. |
+ Copyright 1998-2013 Free Software Foundation, Inc. |
This program is free software; you can redistribute it and/or modify |
it under the terms of the GNU General Public License as published by |
@@ -13,10 +13,7 @@ |
GNU General Public License for more details. |
You should have received a copy of the GNU General Public License |
- along with this program. If not, see <http://www.gnu.org/licenses/>. |
- */ |
- |
- |
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
extern "C" { |
#include <stdio.h> |
@@ -137,6 +134,7 @@ class Diamond : public Padding, public Left, public Right |
{ |
public: |
virtual int vget_base (); |
+ int (*func_ptr) (int); |
}; |
int Diamond::vget_base () |
@@ -144,6 +142,12 @@ int Diamond::vget_base () |
return this->Left::x + 2000; |
} |
+int |
+func (int x) |
+{ |
+ return 19 + x; |
+} |
+ |
int main () |
{ |
A a; |
@@ -161,6 +165,7 @@ int main () |
int (Diamond::*right_vpmf) (); |
int (Base::*base_vpmf) (); |
int Diamond::*diamond_pmi; |
+ int (* Diamond::*diamond_pfunc_ptr) (int); |
PMI null_pmi; |
PMF null_pmf; |
@@ -178,6 +183,7 @@ int main () |
diamond.Left::x = 77; |
diamond.Right::x = 88; |
+ diamond.func_ptr = func; |
/* Some valid pointer to members from a base class. */ |
left_pmf = (int (Diamond::*) ()) (int (Left::*) ()) (&Base::get_x); |
@@ -192,11 +198,17 @@ int main () |
/* A pointer to data member from a base class. */ |
diamond_pmi = (int Diamond::*) (int Left::*) &Base::x; |
+ /* A pointer to data member, where the member is itself a pointer to |
+ a function. */ |
+ diamond_pfunc_ptr = (int (* Diamond::*) (int)) &Diamond::func_ptr; |
+ |
null_pmi = NULL; |
null_pmf = NULL; |
pmi = NULL; /* Breakpoint 1 here. */ |
+ (diamond.*diamond_pfunc_ptr) (20); |
+ |
k = (a.*pmf)(3); |
pmi = &A::jj; |