[PATCH 7/57][Arm][GAS] Add support for MVE instructions: vstr/vldr
[binutils-gdb.git] / gdb / testsuite / gdb.compile / compile-cplus-member.cc
blobbaeafc35f2c188fffb42ff9ff43f80fc9c8f8862
1 /* Copyright 2015-2019 Free Software Foundation, Inc.
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 3 of the License, or
6 (at your option) any later version.
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
13 You should have received a copy of the GNU General Public License
14 along with this program. If not, see <http://www.gnu.org/licenses/>. */
16 class A;
17 static int get_values (const A& a);
19 enum myenum {E_A = 10, E_B, E_C, E_D, E_E};
21 namespace N {
22 typedef enum {NA = 20, NB, NC, ND} ANON_NE;
25 namespace {
26 typedef enum {AA = 40, AB, AC, AD} ANON_E;
29 ANON_E g_e = AC;
31 class A
33 public:
34 typedef int ATYPE;
36 A () : public_ (1), protected_ (N::NB), private_ (3) {}
37 ATYPE public_;
38 static const myenum s_public_;
39 friend ATYPE get_values (const A&);
41 protected:
42 N::ANON_NE protected_;
43 static N::ANON_NE s_protected_;
45 private:
46 ATYPE private_;
47 static myenum s_private_;
50 const myenum A::s_public_ = E_A;
51 N::ANON_NE A::s_protected_ = N::NA;
52 myenum A::s_private_ = E_C;
54 static A::ATYPE
55 get_values (const A& a)
57 A::ATYPE val;
59 val = a.public_ + a.private_; // 1 + 3
60 if (a.protected_ == N::NB) // + 21
61 val += 21;
62 if (a.s_public_ == E_A) // +10
63 val += 10;
64 if (a.s_protected_ == N::NA) // +20
65 val += 20;
66 if (a.s_private_ == E_C) // +30
67 val += 30;
68 if (g_e == AC) // +40
69 val += 40;
70 return val; // = 125
73 typedef int A::*PMI;
75 int
76 main ()
78 A a;
79 int var = 1234;
80 PMI pmi = &A::public_;
82 return a.*pmi + get_values (a); // break here