1 # Copyright
2008-2015 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
/>.
18 if { [prepare_for_testing $
{testfile
}.exp $
{testfile
} $
{srcfile
} {debug c
++}] } {
22 ############################################
24 if ![runto_main
] then {
25 perror
"couldn't run to breakpoint main"
29 gdb_breakpoint
[gdb_get_line_number
"end of main"]
30 gdb_continue_to_breakpoint
"end of main"
32 # Test that overloaded arrow operator works
33 gdb_test
"p mp->foo()" "= 11"
35 # Test that regular arrow operator still works
36 gdb_test
"p mtp->foo()" "= 11"
38 # Test that
normal '.' operator still works.
39 gdb_test
"p mt1.foo()" "= 11"
41 # test that gdb extension
'.' for pointers still works.
42 gdb_test
"p mt4p.a" "= 11"
44 # test that gdb extension
'->' for structs still works.
45 gdb_test
"p mt4->a" "= 11"
47 # Test that templated smart pointers work
48 gdb_test
"p sp1->foo()" "= 11"
49 gdb_test
"p sp2->foo()" "= 22"
51 # Test that overload resolution works properly
53 gdb_test
"p sp3->foo(1)" "= 33"
54 gdb_test
"p sp3->foo('a')" "= 44"
56 # Test smart pointers work
for member references
57 gdb_test
"p sp4->a" "= 11"
58 gdb_test
"p sp4->b" "= 12"
60 # Test regular arrow operator still works
for
62 gdb_test
"p mt4p->a" "= 11"
63 gdb_test
"p mt4p->b" "= 12"
65 # Test that incorrect use of the arrow operator
66 # is still handled correctly.
67 gdb_test
"p mt4->fake" "There is no member named fake."
68 gdb_test
"p mt4->fake()" "Couldn't find method Type4::fake"
70 # Test that overloading of
-> works recursively
71 gdb_test
"p b->foo()" "= 66"
72 gdb_test
"p c->foo()" "= 66"
73 gdb_test
"p c->inta" "= 77"
75 gdb_test
"p c2->inta" "= 77"