1 /* This testcase is part of GDB, the GNU debugger.
3 Copyright 1998, 1999, 2004, 2006, 2007, 2008, 2009, 2010
4 Free Software Foundation, Inc.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
32 virtual int baz (int z
);
53 int A::foo (int dummy
)
59 int A::bar (int dummy
)
64 return r
+ j
+ 2 * dummy
;
67 int A::baz (int dummy
)
72 return r
+ j
+ 12 * dummy
;
77 return 2 + 13 * dummy
;
80 typedef int (A::*PMF
)(int);
84 /* This class is in front of the other base classes of Diamond, so
85 that we can detect if the offset for Left or the first Base is
86 added twice - otherwise it would be 2 * 0 == 0. */
91 virtual int vspacer();
94 int Padding::vspacer()
104 virtual int vget_base ();
112 int Base::vget_base ()
114 return this->x
+ 1000;
117 class Left
: public Base
{
124 return this->x
+ 100;
127 class Right
: public Base
{
134 return this->x
+ 200;
137 class Diamond
: public Padding
, public Left
, public Right
140 virtual int vget_base ();
143 int Diamond::vget_base ()
145 return this->Left::x
+ 2000;
158 int (Diamond::*left_pmf
) ();
159 int (Diamond::*right_pmf
) ();
160 int (Diamond::*left_vpmf
) ();
161 int (Diamond::*left_base_vpmf
) ();
162 int (Diamond::*right_vpmf
) ();
163 int (Base::*base_vpmf
) ();
164 int Diamond::*diamond_pmi
;
180 diamond
.Left::x
= 77;
181 diamond
.Right::x
= 88;
183 /* Some valid pointer to members from a base class. */
184 left_pmf
= (int (Diamond::*) ()) (int (Left::*) ()) (&Base::get_x
);
185 right_pmf
= (int (Diamond::*) ()) (int (Right::*) ()) (&Base::get_x
);
186 left_vpmf
= &Left::vget
;
187 left_base_vpmf
= (int (Diamond::*) ()) (int (Left::*) ()) (&Base::vget_base
);
188 right_vpmf
= &Right::vget
;
190 /* An unspecified, value preserving pointer to member cast. */
191 base_vpmf
= (int (Base::*) ()) (int (Left::*) ()) &Diamond::vget_base
;
193 /* A pointer to data member from a base class. */
194 diamond_pmi
= (int Diamond::*) (int Left::*) &Base::x
;
199 pmi
= NULL
; /* Breakpoint 1 here. */
This page took 0.033516 seconds and 4 git commands to generate.