Automatic Copyright Year update after running gdb/copyright.py
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.cp / cpsizeof.cc
CommitLineData
245a5f0b
KS
1/* This testcase is part of GDB, the GNU debugger.
2
88b9d363 3 Copyright 2014-2022 Free Software Foundation, Inc.
245a5f0b
KS
4
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.
9
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.
14
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/>. */
17
18struct Class
19{
20 int a;
21 char b;
22 long c;
23
24 Class () : a (1), b ('2'), c (3) { }
25};
26
27union Union
28{
29 Class *kp;
30 char a;
31 int b;
32 long c;
33};
34
35enum Enum { A, B, C, D };
36
37typedef unsigned char a4[4];
38typedef unsigned char a8[8];
39typedef unsigned char a12[12];
40typedef Class c4[4];
41typedef Union u8[8];
42typedef Enum e12[12];
43
44#define T(N) \
45 N N ## obj; \
46 N& N ## _ref = N ## obj; \
47 N* N ## p = &(N ## obj); \
48 N*& N ## p_ref = N ## p; \
49 int size_ ## N = sizeof (N ## _ref); \
50 int size_ ## N ## p = sizeof (N ## p_ref); \
51
52int
53main (void)
54{
55 T (char);
56 T (int);
57 T (long);
58 T (float);
59 T (double);
60 T (a4);
61 T (a8);
62 T (a12);
63 T (Class);
64 T (Union);
65 T (Enum);
66 T (c4);
67 T (u8);
68 T (e12);
69
70 return 0; /* break here */
71}
This page took 1.102898 seconds and 4 git commands to generate.