1 /* This testcase is part of GDB, the GNU debugger.
3 Copyright 1998, 1999, 2004, 2006, 2007 Free Software Foundation, Inc.
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
31 virtual int baz (int z
);
52 int A::foo (int dummy
)
58 int A::bar (int dummy
)
63 return r
+ j
+ 2 * dummy
;
66 int A::baz (int dummy
)
71 return r
+ j
+ 12 * dummy
;
76 return 2 + 13 * dummy
;
79 typedef int (A::*PMF
)(int);
83 /* This class is in front of the other base classes of Diamond, so
84 that we can detect if the offset for Left or the first Base is
85 added twice - otherwise it would be 2 * 0 == 0. */
90 virtual int vspacer();
93 int Padding::vspacer()
103 virtual int vget_base ();
111 int Base::vget_base ()
113 return this->x
+ 1000;
116 class Left
: public Base
{
123 return this->x
+ 100;
126 class Right
: public Base
{
133 return this->x
+ 200;
136 class Diamond
: public Padding
, public Left
, public Right
139 virtual int vget_base ();
142 int Diamond::vget_base ()
144 return this->Left::x
+ 2000;
157 int (Diamond::*left_pmf
) ();
158 int (Diamond::*right_pmf
) ();
159 int (Diamond::*left_vpmf
) ();
160 int (Diamond::*left_base_vpmf
) ();
161 int (Diamond::*right_vpmf
) ();
162 int (Base::*base_vpmf
) ();
163 int Diamond::*diamond_pmi
;
179 diamond
.Left::x
= 77;
180 diamond
.Right::x
= 88;
182 /* Some valid pointer to members from a base class. */
183 left_pmf
= (int (Diamond::*) ()) (int (Left::*) ()) (&Base::get_x
);
184 right_pmf
= (int (Diamond::*) ()) (int (Right::*) ()) (&Base::get_x
);
185 left_vpmf
= &Left::vget
;
186 left_base_vpmf
= (int (Diamond::*) ()) (int (Left::*) ()) (&Base::vget_base
);
187 right_vpmf
= &Right::vget
;
189 /* An unspecified, value preserving pointer to member cast. */
190 base_vpmf
= (int (Base::*) ()) (int (Left::*) ()) &Diamond::vget_base
;
192 /* A pointer to data member from a base class. */
193 diamond_pmi
= (int Diamond::*) (int Left::*) &Base::x
;
198 pmi
= NULL
; /* Breakpoint 1 here. */
This page took 0.034158 seconds and 4 git commands to generate.