# Copyright 2008-2013 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . standard_testfile .cc if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} {debug c++}] } { return -1 } ############################################ if ![runto_main] then { perror "couldn't run to breakpoint main" continue } gdb_breakpoint [gdb_get_line_number "end of main"] gdb_continue_to_breakpoint "end of main" # Test that overloaded arrow operator works gdb_test "p mp->foo()" "= 11" # Test that regular arrow operator still works gdb_test "p mtp->foo()" "= 11" # Test that normal '.' operator still works. gdb_test "p mt1.foo()" "= 11" # test that gdb extension '.' for pointers still works. gdb_test "p mt4p.a" "= 11" # test that gdb extension '->' for structs still works. gdb_test "p mt4->a" "= 11" # Test that templated smart pointers work gdb_test "p sp1->foo()" "= 11" gdb_test "p sp2->foo()" "= 22" # Test that overload resolution works properly # with smart pointers gdb_test "p sp3->foo(1)" "= 33" gdb_test "p sp3->foo('a')" "= 44" # Test smart pointers work for member references gdb_test "p sp4->a" "= 11" gdb_test "p sp4->b" "= 12" # Test regular arrow operator still works for # member references gdb_test "p mt4p->a" "= 11" gdb_test "p mt4p->b" "= 12" # Test that incorrect use of the arrow operator # is still handled correctly. gdb_test "p mt4->fake" "There is no member named fake." gdb_test "p mt4->fake()" "Couldn't find method Type4::fake" # Test that overloading of -> works recursively gdb_test "p b->foo()" "= 66" gdb_test "p c->foo()" "= 66" gdb_test "p c->inta" "= 77" setup_kfail "gdb/11606" "*-*-*" gdb_test "p c2->inta" "= 77"