Automatic Copyright Year update after running gdb/copyright.py
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.linespec / cp-completion-aliases.cc
CommitLineData
19a2740f
AB
1/* This testcase is part of GDB, the GNU debugger.
2
88b9d363 3 Copyright 2019-2022 Free Software Foundation, Inc.
19a2740f
AB
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
18#include <cstring>
19
20template<typename T>
21struct magic
22{
23 T x;
24};
25
26struct object
27{
28 int a;
29};
30
31typedef magic<int> int_magic_t;
32
33typedef object *object_p;
34
35typedef const char *my_string_t;
36
37static int
38get_value (object_p obj)
39{
40 return obj->a;
41}
42
43static int
44get_something (object_p obj)
45{
46 return obj->a;
47}
48
49static int
50get_something (my_string_t msg)
51{
52 return strlen (msg);
53}
54
55static int
56grab_it (int_magic_t *var)
57{
58 return var->x;
59}
60
61int
62main ()
63{
64 magic<int> m;
65 m.x = 4;
66
67 object obj;
68 obj.a = 0;
69
70 int val = (get_value (&obj) + get_something (&obj)
71 + get_something ("abc") + grab_it (&m));
72 return val;
73}
This page took 0.238684 seconds and 4 git commands to generate.