/* This testcase is part of GDB, the GNU debugger.
- Copyright 1998, 1999, 2004, 2006, 2007, 2008, 2009
- Free Software Foundation, Inc.
+ Copyright 1998-2016 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
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>
{
public:
virtual int vget_base ();
+ int (*func_ptr) (int);
};
int Diamond::vget_base ()
return this->Left::x + 2000;
}
+int
+func (int x)
+{
+ return 19 + x;
+}
+
int main ()
{
A a;
int (Diamond::*right_vpmf) ();
int (Base::*base_vpmf) ();
int Diamond::*diamond_pmi;
+ int (* Diamond::*diamond_pfunc_ptr) (int);
PMI null_pmi;
PMF null_pmf;
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);
/* 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;