Commit | Line | Data |
---|---|---|
88b9d363 | 1 | # Copyright 2021-2022 Free Software Foundation, Inc. |
79bd4d34 AB |
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 | |
13221aec AB |
42 | |
43 | set result [expr $result + 3] | |
44 | gdb_test "print foo += b" \ | |
45 | " = \\((?:struct )?foo_type &\\) @${hex}: \\\{var = ${result}\\\}" | |
d038ce48 AB |
46 | |
47 | gdb_test "print foo.static_method (f, b)" " = 4" | |
48 | gdb_test "print foo_type::static_method (f, b)" " = 4" | |
79bd4d34 AB |
49 | } |
50 | } |