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/>. */
17 static int get_values (const A
& a
);
19 enum myenum
{E_A
= 10, E_B
, E_C
, E_D
, E_E
};
22 typedef enum {NA
= 20, NB
, NC
, ND
} ANON_NE
;
26 typedef enum {AA
= 40, AB
, AC
, AD
} ANON_E
;
36 A () : public_ (1), protected_ (N::NB
), private_ (3) {}
38 static const myenum s_public_
;
39 friend ATYPE
get_values (const A
&);
42 N::ANON_NE protected_
;
43 static N::ANON_NE s_protected_
;
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
;
55 get_values (const A
& a
)
59 val
= a
.public_
+ a
.private_
; // 1 + 3
60 if (a
.protected_
== N::NB
) // + 21
62 if (a
.s_public_
== E_A
) // +10
64 if (a
.s_protected_
== N::NA
) // +20
66 if (a
.s_private_
== E_C
) // +30
80 PMI pmi
= &A::public_
;
82 return a
.*pmi
+ get_values (a
); // break here