]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.cp/method-call-in-c.exp
gdb: fix regression in evaluate_funcall for non C++ like cases
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.cp / method-call-in-c.exp
1 # Copyright 2021 Free Software Foundation, Inc.
2
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.
7 #
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.
12 #
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/>.
15
16 # Ensure that calling a member function works correctly even when the
17 # language is forced to 'C' (this should be fine, so long at no
18 # overload resolution is required), or when overload-resolution is
19 # off.
20
21 standard_testfile .cc
22
23 if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
24 return -1
25 }
26
27 if ![runto_main] then {
28 return 0
29 }
30
31 gdb_breakpoint [gdb_get_line_number "Break here"]
32 gdb_continue_to_breakpoint "Break here"
33
34 set result 123
35 foreach_with_prefix lang { c++ c } {
36 foreach_with_prefix overload_resolution { on off } {
37 gdb_test_no_output "set overload-resolution ${overload_resolution}"
38 gdb_test "set language ${lang}"
39
40 gdb_test "print foo.func (b, f)" " = ${result}"
41 incr result
42 }
43 }